keep all args handling in main.go for now

This commit is contained in:
Liam Staskawicz 2012-12-15 12:10:00 -08:00
parent c8383e8a34
commit 2bc4ab80a0
2 changed files with 4 additions and 4 deletions

View File

@ -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

View 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)
}