Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missed migration in #22235 #23482

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions models/fixtures/project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-
id: 1
title: First project
owner_id: 0
repo_id: 1
is_closed: false
creator_id: 2
Expand All @@ -10,6 +11,7 @@
-
id: 2
title: second project
owner_id: 0
repo_id: 3
is_closed: false
creator_id: 3
Expand All @@ -19,6 +21,7 @@
-
id: 3
title: project on repo with disabled project
owner_id: 0
repo_id: 4
is_closed: true
creator_id: 5
Expand All @@ -29,6 +32,7 @@
id: 4
title: project on user2
owner_id: 2
repo_id: 0
is_closed: false
creator_id: 2
board_type: 1
Expand Down
2 changes: 2 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ var migrations = []Migration{
NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun),
// v245 -> v246
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
Expand Down
16 changes: 16 additions & 0 deletions models/migrations/v1_20/v246.go
Original file line number Diff line number Diff line change
@@ -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))
}