v17.go 549 B

1234567891011121314151617181920212223
  1. // Copyright 2017 The Gogs 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 (
  6. "fmt"
  7. "github.com/go-xorm/xorm"
  8. )
  9. func removeInvalidProtectBranchWhitelist(x *xorm.Engine) error {
  10. exist, err := x.IsTableExist("protect_branch_whitelist")
  11. if err != nil {
  12. return fmt.Errorf("IsTableExist: %v", err)
  13. } else if !exist {
  14. return nil
  15. }
  16. _, err = x.Exec("DELETE FROM protect_branch_whitelist WHERE protect_branch_id = 0")
  17. return err
  18. }