fix postgres ci

This commit is contained in:
Lunny Xiao 2019-01-23 15:18:57 +08:00
parent f337f2c215
commit 098b98461e
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 6 additions and 0 deletions

View File

@ -75,6 +75,12 @@ func createEngine(dbType, connStr string) error {
} }
} }
if *schema != "" { if *schema != "" {
db.Close()
db, err = sql.Open(dbType, connStr)
if err != nil {
return err
}
defer db.Close()
if _, err = db.Exec("CREATE SCHEMA IF NOT EXISTS " + *schema); err != nil { if _, err = db.Exec("CREATE SCHEMA IF NOT EXISTS " + *schema); err != nil {
return fmt.Errorf("CREATE SCHEMA: %v", err) return fmt.Errorf("CREATE SCHEMA: %v", err)
} }