Skip to content

Commit

Permalink
wrap error with information of migration id
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed Oct 1, 2021
1 parent af31dbb commit 856ca33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gormigrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (g *Gormigrate) rollbackMigration(m *Migration) error {
}

if err := m.Rollback(g.tx); err != nil {
return err
return fmt.Errorf("migration-step %s: %w",m.ID, err)
}

sql := fmt.Sprintf("DELETE FROM %s WHERE %s = ?", g.options.TableName, g.options.IDColumnName)
Expand Down Expand Up @@ -362,7 +362,7 @@ func (g *Gormigrate) runMigration(migration *Migration) error {
}
if !migrationRan {
if err := migration.Migrate(g.tx); err != nil {
return err
return fmt.Errorf("migration-step %s: %w",migration.ID, err)
}

if err := g.insertMigration(migration.ID); err != nil {
Expand Down

0 comments on commit 856ca33

Please sign in to comment.