mirror of https://github.com/pressly/goose.git
migrate: refactor sorting of migrations out of the collection routine
parent
8c4171074b
commit
ef4602b5e8
|
@ -55,6 +55,8 @@ func runMigrations(conf *DBConf, migrationsDir string, target int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm.Sort(current < target)
|
||||||
|
|
||||||
fmt.Printf("goose: migrating db environment '%v', current version: %d, target: %d\n",
|
fmt.Printf("goose: migrating db environment '%v', current version: %d, target: %d\n",
|
||||||
conf.Env, current, target)
|
conf.Env, current, target)
|
||||||
|
|
||||||
|
@ -108,10 +110,6 @@ func collectMigrations(dirpath string, current, target int) (mm *MigrationMap, e
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(mm.Versions) > 0 {
|
|
||||||
mm.Sort(current < target)
|
|
||||||
}
|
|
||||||
|
|
||||||
return mm, nil
|
return mm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue