You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
671 B

  1. // Copyright 2019 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. package migrations
  5. import "xorm.io/xorm"
  6. func addStatusCheckColumnsForProtectedBranches(x *xorm.Engine) error {
  7. type ProtectedBranch struct {
  8. EnableStatusCheck bool `xorm:"NOT NULL DEFAULT false"`
  9. StatusCheckContexts []string `xorm:"JSON TEXT"`
  10. }
  11. if err := x.Sync2(new(ProtectedBranch)); err != nil {
  12. return err
  13. }
  14. _, err := x.Cols("enable_status_check", "status_check_contexts").Update(&ProtectedBranch{
  15. EnableStatusCheck: false,
  16. StatusCheckContexts: []string{},
  17. })
  18. return err
  19. }