fix postgres schema tests

This commit is contained in:
Lunny Xiao 2019-01-21 21:28:45 +08:00
parent 7ecdf5b255
commit 0cd6d581ad
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 4 additions and 5 deletions

View File

@ -54,11 +54,10 @@ func createEngine(dbType, connStr string) error {
}
defer rows.Close()
if rows.Next() {
break
}
if _, err = db.Exec("CREATE DATABASE xorm_test"); err != nil {
return fmt.Errorf("db.Exec: %v", err)
if !rows.Next() {
if _, err = db.Exec("CREATE DATABASE xorm_test"); err != nil {
return fmt.Errorf("db.Exec: %v", err)
}
}
if schema != nil {
if _, err = db.Exec("CREATE SCHEMA " + *schema); err != nil {