Skip to content

Commit 5e4ecdc

Browse files
authored
Merge pull request #150 from jecepeda/fix-error-message-on-redo
Print error message on redo command
2 parents 8926f37 + 5addc8d commit 5e4ecdc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

sql-migrate/command_redo.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/rubenv/sql-migrate"
8+
migrate "github.com/rubenv/sql-migrate"
99
)
1010

1111
type RedoCommand struct {
@@ -60,7 +60,10 @@ func (c *RedoCommand) Run(args []string) int {
6060
}
6161

6262
migrations, _, err := migrate.PlanMigration(db, dialect, source, migrate.Down, 1)
63-
if len(migrations) == 0 {
63+
if err != nil {
64+
ui.Error(fmt.Sprintf("Migration (redo) failed: %v", err))
65+
return 1
66+
} else if len(migrations) == 0 {
6467
ui.Output("Nothing to do!")
6568
return 0
6669
}

0 commit comments

Comments
 (0)