mirror of
https://github.com/pressly/goose.git
synced 2025-05-31 11:42:04 +00:00
keep all args handling in main.go for now
This commit is contained in:
parent
c8383e8a34
commit
2bc4ab80a0
@ -27,7 +27,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
runMigrations(conf, *targetVersion)
|
||||
runMigrations(conf, path.Join(*dbFolder, "migrations"), *targetVersion)
|
||||
}
|
||||
|
||||
// extract configuration details from the given file
|
||||
|
@ -31,20 +31,20 @@ type MigrationMap struct {
|
||||
Direction bool // sort direction: true -> Up, false -> Down
|
||||
}
|
||||
|
||||
func runMigrations(conf *DBConf, target int) {
|
||||
func runMigrations(conf *DBConf, migrationsDir string, target int) {
|
||||
|
||||
db, err := sql.Open(conf.Driver, conf.OpenStr)
|
||||
if err != nil {
|
||||
log.Fatal("couldn't open DB:", err)
|
||||
}
|
||||
defer db.Close()
|
||||
defer db.Close()
|
||||
|
||||
current, e := ensureDBVersion(db)
|
||||
if e != nil {
|
||||
log.Fatal("couldn't get/set DB version")
|
||||
}
|
||||
|
||||
mm, err := collectMigrations(path.Join(*dbFolder, "migrations"), current, target)
|
||||
mm, err := collectMigrations(migrationsDir, current, target)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user