v17.go 533 B

12345678910111213141516171819
  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. "strings"
  7. "github.com/go-xorm/xorm"
  8. )
  9. func removeInvalidProtectBranchWhitelist(x *xorm.Engine) error {
  10. _, err := x.Exec("DELETE FROM protect_branch_whitelist WHERE protect_branch_id = 0")
  11. if err != nil && (strings.Contains(err.Error(), "no such table") || strings.Contains(err.Error(), "doesn't exist")) {
  12. return nil
  13. }
  14. return err
  15. }