2017-09-14 11:16:22 +03:00
|
|
|
// 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 (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/go-xorm/xorm"
|
|
|
|
)
|
|
|
|
|
2017-12-13 17:52:18 +03:00
|
|
|
func fixProtectedBranchCanPushValue(x *xorm.Engine) error {
|
2017-09-14 11:16:22 +03:00
|
|
|
type ProtectedBranch struct {
|
2017-12-13 17:52:18 +03:00
|
|
|
CanPush bool `xorm:"NOT NULL DEFAULT false"`
|
2017-09-14 11:16:22 +03:00
|
|
|
}
|
|
|
|
|
2017-12-13 17:52:18 +03:00
|
|
|
if err := x.Sync2(new(ProtectedBranch)); err != nil {
|
|
|
|
return fmt.Errorf("Sync2: %v", err)
|
2017-09-14 11:16:22 +03:00
|
|
|
}
|
|
|
|
|
2017-12-13 17:52:18 +03:00
|
|
|
_, err := x.Cols("can_push").Update(&ProtectedBranch{
|
|
|
|
CanPush: false,
|
|
|
|
})
|
|
|
|
return err
|
2017-09-14 11:16:22 +03:00
|
|
|
}
|