Skip to content

Commit 2db424c

Browse files
lafrikslunny
authored andcommitted
Fix broken migration to add can_push field back to table (#2574)
1 parent ccff571 commit 2db424c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

models/migrations/v43.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55
package migrations
66

77
import (
8-
"code.gitea.io/gitea/models"
8+
"fmt"
99

1010
"github.com/go-xorm/xorm"
1111
)
1212

1313
func fixProtectedBranchCanPushValue(x *xorm.Engine) error {
14-
_, err := x.Cols("can_push").Update(&models.ProtectedBranch{
14+
type ProtectedBranch struct {
15+
CanPush bool `xorm:"NOT NULL DEFAULT false"`
16+
}
17+
18+
if err := x.Sync2(new(ProtectedBranch)); err != nil {
19+
return fmt.Errorf("Sync2: %v", err)
20+
}
21+
22+
_, err := x.Cols("can_push").Update(&ProtectedBranch{
1523
CanPush: false,
1624
})
1725
return err

0 commit comments

Comments
 (0)