mirror of https://github.com/go-gitea/gitea.git
Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
869fd17b88
commit
65ef634d5c
|
@ -152,6 +152,7 @@ func restoreOldDB(t *testing.T, version string) bool {
|
||||||
|
|
||||||
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", setting.Database.Name))
|
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", setting.Database.Name))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
db.Close()
|
||||||
|
|
||||||
db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?multiStatements=true",
|
db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?multiStatements=true",
|
||||||
setting.Database.User, setting.Database.Passwd, setting.Database.Host, setting.Database.Name))
|
setting.Database.User, setting.Database.Passwd, setting.Database.Host, setting.Database.Name))
|
||||||
|
@ -182,6 +183,8 @@ func restoreOldDB(t *testing.T, version string) bool {
|
||||||
if !assert.NoError(t, err) {
|
if !assert.NoError(t, err) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
schrows, err := db.Query(fmt.Sprintf("SELECT 1 FROM information_schema.schemata WHERE schema_name = '%s'", setting.Database.Schema))
|
schrows, err := db.Query(fmt.Sprintf("SELECT 1 FROM information_schema.schemata WHERE schema_name = '%s'", setting.Database.Schema))
|
||||||
if !assert.NoError(t, err) || !assert.NotEmpty(t, schrows) {
|
if !assert.NoError(t, err) || !assert.NotEmpty(t, schrows) {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue