mirror of https://github.com/pressly/goose.git
Improved internal driver conversion
parent
3f3c7a46a9
commit
c09709c167
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue