Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,15 @@ func (ms MigrationSet) ExecMax(db *sql.DB, dialect string, m MigrationSource, di
stmt = strings.TrimSuffix(stmt, "\n")
stmt = strings.TrimSuffix(stmt, " ")
stmt = strings.TrimSuffix(stmt, ";")
ms.Log.Println(stmt)
if _, err := executor.Exec(stmt); err != nil {
if trans, ok := executor.(*gorp.Transaction); ok {
_ = trans.Rollback()
}

return applied, newTxError(migration, err)
}
ms.Log.Println("Success!")
}

switch dir {
Expand Down
1 change: 1 addition & 0 deletions sql-migrate/command_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Options:
-env="development" Environment.
-limit=1 Limit the number of migrations (0 = unlimited).
-dryrun Don't apply migrations, just print them.
-verbose Show queries in console.

`
return strings.TrimSpace(helpText)
Expand Down
3 changes: 2 additions & 1 deletion sql-migrate/command_up.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Options:
-env="development" Environment.
-limit=0 Limit the number of migrations (0 = unlimited).
-dryrun Don't apply migrations, just print them.
-verbose Show queries in console.

`
return strings.TrimSpace(helpText)
Expand All @@ -40,7 +41,7 @@ func (c *UpCommand) Run(args []string) int {
cmdFlags.Usage = func() { ui.Output(c.Help()) }
cmdFlags.IntVar(&limit, "limit", 0, "Max number of migrations to apply.")
cmdFlags.BoolVar(&dryrun, "dryrun", false, "Don't apply migrations, just print them.")
cmdFlags.BoolVar(&verbose, "verbose", false, "Show queries at console")
cmdFlags.BoolVar(&verbose, "verbose", false, "Show queries in console")
ConfigFlags(cmdFlags)

if err := cmdFlags.Parse(args); err != nil {
Expand Down