Skip to content

Commit 27494ed

Browse files
lunnytechknowlogickKN4CK3R
authored
Fix missed migration in #22235 (#23482)
Co-authored-by: techknowlogick <[email protected]> Co-authored-by: KN4CK3R <[email protected]>
1 parent 0d7cf7b commit 27494ed

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

models/fixtures/project.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-
22
id: 1
33
title: First project
4+
owner_id: 0
45
repo_id: 1
56
is_closed: false
67
creator_id: 2
@@ -10,6 +11,7 @@
1011
-
1112
id: 2
1213
title: second project
14+
owner_id: 0
1315
repo_id: 3
1416
is_closed: false
1517
creator_id: 3
@@ -19,6 +21,7 @@
1921
-
2022
id: 3
2123
title: project on repo with disabled project
24+
owner_id: 0
2225
repo_id: 4
2326
is_closed: true
2427
creator_id: 5
@@ -29,6 +32,7 @@
2932
id: 4
3033
title: project on user2
3134
owner_id: 2
35+
repo_id: 0
3236
is_closed: false
3337
creator_id: 2
3438
board_type: 1

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ var migrations = []Migration{
469469
NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun),
470470
// v245 -> v246
471471
NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner),
472+
// v246 -> v247
473+
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
472474
}
473475

474476
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v246.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"xorm.io/xorm"
8+
)
9+
10+
func AddNewColumnForProject(x *xorm.Engine) error {
11+
type Project struct {
12+
OwnerID int64 `xorm:"INDEX"`
13+
}
14+
15+
return x.Sync(new(Project))
16+
}

0 commit comments

Comments
 (0)