mirror of
https://github.com/beego/bee.git
synced 2024-11-29 11:41:28 +00:00
halt when there is nothing to rollback
This commit is contained in:
parent
923a02f99b
commit
ef8e6750a0
@ -152,6 +152,10 @@ func migrate(goal, crupath, driver, connStr string) {
|
|||||||
defer db.Close()
|
defer db.Close()
|
||||||
checkForSchemaUpdateTable(db)
|
checkForSchemaUpdateTable(db)
|
||||||
latestName, latestTime := getLatestMigration(db)
|
latestName, latestTime := getLatestMigration(db)
|
||||||
|
if goal == "rollback" && latestName == "" {
|
||||||
|
ColorLog("[ERRO] There is nothing to rollback\n")
|
||||||
|
os.Exit(2)
|
||||||
|
}
|
||||||
writeMigrationSourceFile(dir, source, driver, connStr, latestTime, latestName, goal)
|
writeMigrationSourceFile(dir, source, driver, connStr, latestTime, latestName, goal)
|
||||||
buildMigrationBinary(dir, binary)
|
buildMigrationBinary(dir, binary)
|
||||||
runMigrationBinary(dir, binary)
|
runMigrationBinary(dir, binary)
|
||||||
|
Loading…
Reference in New Issue
Block a user