|
|
@ -13,6 +13,7 @@ import ( |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"regexp" |
|
|
|
"regexp" |
|
|
|
"sort" |
|
|
|
"sort" |
|
|
|
|
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/integrations" |
|
|
|
"code.gitea.io/gitea/integrations" |
|
|
@ -120,8 +121,7 @@ func readSQLFromFile(version string) (string, error) { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return "", err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return string(base.RemoveBOMIfPresent(bytes)), nil |
|
|
|
return string(bytes), nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func restoreOldDB(t *testing.T, version string) bool { |
|
|
|
func restoreOldDB(t *testing.T, version string) bool { |
|
|
@ -199,11 +199,11 @@ func restoreOldDB(t *testing.T, version string) bool { |
|
|
|
_, err = db.Exec("DROP DATABASE IF EXISTS gitea") |
|
|
|
_, err = db.Exec("DROP DATABASE IF EXISTS gitea") |
|
|
|
assert.NoError(t, err) |
|
|
|
assert.NoError(t, err) |
|
|
|
|
|
|
|
|
|
|
|
_, err = db.Exec("CREATE DATABASE gitea") |
|
|
|
statements := strings.Split(data, "\nGO\n") |
|
|
|
assert.NoError(t, err) |
|
|
|
for _, statement := range statements { |
|
|
|
|
|
|
|
_, err = db.Exec(statement) |
|
|
|
_, err = db.Exec(data) |
|
|
|
assert.NoError(t, err, "Failure whilst running: %s\nError: %v", statement, err) |
|
|
|
assert.NoError(t, err) |
|
|
|
} |
|
|
|
db.Close() |
|
|
|
db.Close() |
|
|
|
} |
|
|
|
} |
|
|
|
return true |
|
|
|
return true |
|
|
|