mirror of https://github.com/pressly/goose.git
migration sql: error out if no annotations are found, rather than marking the migration as having run successfully.
parent
09e81b9cb9
commit
c9a4615595
|
@ -65,16 +65,17 @@ func runSQLMigration(db *sql.DB, script string, v int64, direction bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
if err = finalizeMigration(txn, direction, v); err != nil {
|
||||
log.Fatalf("error finalizing migration %s, quitting. (%v)", filepath.Base(script), err)
|
||||
}
|
||||
|
||||
if upSections == 0 && downSections == 0 {
|
||||
log.Printf(`WARNING: no Up/Down annotations found in %s, so no statements were executed.
|
||||
txn.Rollback()
|
||||
log.Fatalf(`ERROR: no Up/Down annotations found in %s, so no statements were executed.
|
||||
See https://bitbucket.org/liamstask/goose/overview for details.`,
|
||||
filepath.Base(script))
|
||||
}
|
||||
|
||||
if err = finalizeMigration(txn, direction, v); err != nil {
|
||||
log.Fatalf("error finalizing migration %s, quitting. (%v)", filepath.Base(script), err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue