File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ const (
17
17
18
18
// ProtectedBranch struct
19
19
type ProtectedBranch struct {
20
- ID int64 `xorm:"pk autoincr"`
21
- RepoID int64 `xorm:"UNIQUE(s)"`
22
- BranchName string `xorm:"UNIQUE(s)"`
23
- CanPush bool
20
+ ID int64 `xorm:"pk autoincr"`
21
+ RepoID int64 `xorm:"UNIQUE(s)"`
22
+ BranchName string `xorm:"UNIQUE(s)"`
23
+ CanPush bool `xorm:"NOT NULL DEFAULT false"`
24
24
Created time.Time `xorm:"-"`
25
25
CreatedUnix int64
26
26
Updated time.Time `xorm:"-"`
Original file line number Diff line number Diff line change @@ -126,6 +126,8 @@ var migrations = []Migration{
126
126
NewMigration ("unescape user full names" , unescapeUserFullNames ),
127
127
// v38 -> v39
128
128
NewMigration ("remove commits and settings unit types" , removeCommitsUnitType ),
129
+ // v43 -> v44
130
+ NewMigration ("fix protected branch can push value to false" , fixProtectedBranchCanPushValue ),
129
131
}
130
132
131
133
// Migrate database to current version
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 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
+ "code.gitea.io/gitea/models"
9
+
10
+ "github.com/go-xorm/xorm"
11
+ )
12
+
13
+ func fixProtectedBranchCanPushValue (x * xorm.Engine ) error {
14
+ _ , err := x .Cols ("can_push" ).Update (& models.ProtectedBranch {
15
+ CanPush : false ,
16
+ })
17
+ return err
18
+ }
You can’t perform that action at this time.
0 commit comments