Skip to content

Commit 8a3937f

Browse files
committed
add migration and fix lint
1 parent 1117632 commit 8a3937f

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

models/migrations/migrations.go

+2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ var migrations = []Migration{
258258
NewMigration("update migration repositories' service type", updateMigrationServiceTypes),
259259
// v101 -> v102
260260
NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser),
261+
// v102 -> v103
262+
NewMigration("update migration repositories' service type", dropColumnHeadUserNameOnPullRequest),
261263
}
262264

263265
// Migrate database to current version

models/migrations/v102.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2019 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import (
8+
"xorm.io/xorm"
9+
)
10+
11+
func dropColumnHeadUserNameOnPullRequest(x *xorm.Engine) error {
12+
sess := x.NewSession()
13+
defer sess.Close()
14+
return dropTableColumns(sess, "pull_request", "head_user_name")
15+
}

models/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (pr *PullRequest) LoadBaseRepo() error {
121121
return nil
122122
}
123123

124-
// LoadBaseRepo loads pull request base repository from database
124+
// LoadHeadRepo loads pull request head repository from database
125125
func (pr *PullRequest) LoadHeadRepo() error {
126126
if pr.HeadRepo == nil {
127127
if pr.HeadRepoID == pr.BaseRepoID && pr.BaseRepo != nil {

0 commit comments

Comments
 (0)