Fix missed migration in #22235 (#23482)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
Lunny Xiao 2023-03-15 17:33:10 +08:00 committed by GitHub
parent 0d7cf7b768
commit 27494ed20d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,7 @@
- -
id: 1 id: 1
title: First project title: First project
owner_id: 0
repo_id: 1 repo_id: 1
is_closed: false is_closed: false
creator_id: 2 creator_id: 2
@ -10,6 +11,7 @@
- -
id: 2 id: 2
title: second project title: second project
owner_id: 0
repo_id: 3 repo_id: 3
is_closed: false is_closed: false
creator_id: 3 creator_id: 3
@ -19,6 +21,7 @@
- -
id: 3 id: 3
title: project on repo with disabled project title: project on repo with disabled project
owner_id: 0
repo_id: 4 repo_id: 4
is_closed: true is_closed: true
creator_id: 5 creator_id: 5
@ -29,6 +32,7 @@
id: 4 id: 4
title: project on user2 title: project on user2
owner_id: 2 owner_id: 2
repo_id: 0
is_closed: false is_closed: false
creator_id: 2 creator_id: 2
board_type: 1 board_type: 1

View File

@ -469,6 +469,8 @@ var migrations = []Migration{
NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun), NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun),
// v245 -> v246 // v245 -> v246
NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner), NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner),
// v246 -> v247
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
} }
// GetCurrentDBVersion returns the current db version // GetCurrentDBVersion returns the current db version

View File

@ -0,0 +1,16 @@
// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_20 //nolint
import (
"xorm.io/xorm"
)
func AddNewColumnForProject(x *xorm.Engine) error {
type Project struct {
OwnerID int64 `xorm:"INDEX"`
}
return x.Sync(new(Project))
}