Skip to content

Commit f1ae5df

Browse files
committed
Fix table handling in command-line util.
1 parent 7bb8b6b commit f1ae5df

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

sql-migrate/command_common.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ func ApplyMigrations(dir migrate.MigrationDirection, dryrun bool, limit int) err
1717
return err
1818
}
1919

20-
migrate.SetTable(env.TableName)
21-
2220
source := migrate.FileMigrationSource{
2321
Dir: env.Dir,
2422
}

sql-migrate/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io/ioutil"
99

1010
"github.com/coopernurse/gorp"
11+
"github.com/rubenv/sql-migrate"
1112
"gopkg.in/yaml.v1"
1213

1314
_ "github.com/go-sql-driver/mysql"
@@ -74,6 +75,10 @@ func GetEnvironment() (*Environment, error) {
7475
env.Dir = "migrations"
7576
}
7677

78+
if env.TableName != "" {
79+
migrate.SetTable(env.TableName)
80+
}
81+
7782
return env, nil
7883
}
7984

0 commit comments

Comments
 (0)