summaryrefslogtreecommitdiffstats
path: root/integrations/migration-test/migration_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/migration-test/migration_test.go')
-rw-r--r--integrations/migration-test/migration_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go
index 15b086c6e6..fd0d0b7c72 100644
--- a/integrations/migration-test/migration_test.go
+++ b/integrations/migration-test/migration_test.go
@@ -181,11 +181,19 @@ func restoreOldDB(t *testing.T, version string) bool {
assert.NoError(t, err)
defer db.Close()
- _, err = db.Exec("DROP DATABASE IF EXISTS gitea")
+ _, err = db.Exec("DROP DATABASE IF EXISTS [gitea]")
assert.NoError(t, err)
statements := strings.Split(data, "\nGO\n")
for _, statement := range statements {
+ if len(statement) > 5 && statement[:5] == "USE [" {
+ dbname := statement[5 : len(statement)-1]
+ db.Close()
+ db, err = sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;",
+ host, port, dbname, models.DbCfg.User, models.DbCfg.Passwd))
+ assert.NoError(t, err)
+ defer db.Close()
+ }
_, err = db.Exec(statement)
assert.NoError(t, err, "Failure whilst running: %s\nError: %v", statement, err)
}