Fix can_push value to false in protected_branch (#2560)
This commit is contained in:
parent
6f380a22a4
commit
6718ea6ff1
3 changed files with 21 additions and 0 deletions
|
@ -26,6 +26,7 @@ type ProtectedBranch struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
RepoID int64 `xorm:"UNIQUE(s)"`
|
RepoID int64 `xorm:"UNIQUE(s)"`
|
||||||
BranchName string `xorm:"UNIQUE(s)"`
|
BranchName string `xorm:"UNIQUE(s)"`
|
||||||
|
CanPush bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
EnableWhitelist bool
|
EnableWhitelist bool
|
||||||
WhitelistUserIDs []int64 `xorm:"JSON TEXT"`
|
WhitelistUserIDs []int64 `xorm:"JSON TEXT"`
|
||||||
WhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
|
WhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
|
||||||
|
|
|
@ -134,6 +134,8 @@ var migrations = []Migration{
|
||||||
NewMigration("add default value to user prohibit_login", addDefaultValueToUserProhibitLogin),
|
NewMigration("add default value to user prohibit_login", addDefaultValueToUserProhibitLogin),
|
||||||
// v42 -> v43
|
// v42 -> v43
|
||||||
NewMigration("add tags to releases and sync existing repositories", releaseAddColumnIsTagAndSyncTags),
|
NewMigration("add tags to releases and sync existing repositories", releaseAddColumnIsTagAndSyncTags),
|
||||||
|
// v43 -> v44
|
||||||
|
NewMigration("fix protected branch can push value to false", fixProtectedBranchCanPushValue),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate database to current version
|
// Migrate database to current version
|
||||||
|
|
18
models/migrations/v43.go
Normal file
18
models/migrations/v43.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.gitea.io/gitea/models"
|
||||||
|
|
||||||
|
"github.com/go-xorm/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func fixProtectedBranchCanPushValue(x *xorm.Engine) error {
|
||||||
|
_, err := x.Cols("can_push").Update(&models.ProtectedBranch{
|
||||||
|
CanPush: false,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
Reference in a new issue