Improved internal driver conversion

pull/85/head
Simon Wikstrand 2017-12-06 12:08:46 +01:00
parent 3f3c7a46a9
commit c09709c167
No known key found for this signature in database
GPG Key ID: 1FE8AC12BCDD37E7
1 changed files with 8 additions and 14 deletions

View File

@ -45,13 +45,15 @@ func main() {
driver, dbstring, command := args[0], args[1], args[2]
if err := goose.SetDialect(driver); err != nil {
log.Fatal(err)
}
switch driver {
case "postgres", "mysql", "sqlite3", "redshift", "tidb":
if err := goose.SetDialect(driver); err != nil {
log.Fatal(err)
}
default:
log.Fatalf("%q driver not supported\n", driver)
case "redshift":
driver = "postgres"
case "tidb":
driver = "mysql"
}
switch dbstring {
@ -60,14 +62,6 @@ func main() {
default:
}
if driver == "redshift" {
driver = "postgres"
}
if driver == "tidb" {
driver = "mysql"
}
db, err := sql.Open(driver, dbstring)
if err != nil {
log.Fatalf("-dbstring=%q: %v\n", dbstring, err)