summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-09-23 11:45:41 +0300
committerLunny Xiao <xiaolunwen@gmail.com>2017-09-23 16:45:41 +0800
commit2db424c3f157409603645310a598dd0d974d90bf (patch)
tree18df4c1fb169529991666050c9c6c1aaaaae6f9f /models/migrations
parentccff57103ae250ad8187926e3740f28c1e23a815 (diff)
downloadgitea-2db424c3f157409603645310a598dd0d974d90bf.tar.gz
gitea-2db424c3f157409603645310a598dd0d974d90bf.zip
Fix broken migration to add can_push field back to table (#2574)
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/v43.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/models/migrations/v43.go b/models/migrations/v43.go
index b6351fa831..fffe158bf9 100644
--- a/models/migrations/v43.go
+++ b/models/migrations/v43.go
@@ -5,13 +5,21 @@
package migrations
import (
- "code.gitea.io/gitea/models"
+ "fmt"
"github.com/go-xorm/xorm"
)
func fixProtectedBranchCanPushValue(x *xorm.Engine) error {
- _, err := x.Cols("can_push").Update(&models.ProtectedBranch{
+ type ProtectedBranch struct {
+ CanPush bool `xorm:"NOT NULL DEFAULT false"`
+ }
+
+ if err := x.Sync2(new(ProtectedBranch)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+
+ _, err := x.Cols("can_push").Update(&ProtectedBranch{
CanPush: false,
})
return err