We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1afafde commit 4a67bb5Copy full SHA for 4a67bb5
models/migrations/v17.go
@@ -5,15 +5,18 @@
5
package migrations
6
7
import (
8
- "strings"
+ "fmt"
9
10
"github.com/go-xorm/xorm"
11
)
12
13
func removeInvalidProtectBranchWhitelist(x *xorm.Engine) error {
14
- _, err := x.Exec("DELETE FROM protect_branch_whitelist WHERE protect_branch_id = 0")
15
- if err != nil && (strings.Contains(err.Error(), "no such table") || strings.Contains(err.Error(), "doesn't exist")) {
+ exist, err := x.IsTableExist("protect_branch_whitelist")
+ if err != nil {
16
+ return fmt.Errorf("IsTableExist: %v", err)
17
+ } else if !exist {
18
return nil
19
}
20
+ _, err = x.Exec("DELETE FROM protect_branch_whitelist WHERE protect_branch_id = 0")
21
return err
22
0 commit comments