Skip to content

Commit

Permalink
add some debugging (#52)
Browse files Browse the repository at this point in the history
* add some debugging

* lint
  • Loading branch information
muir authored Dec 8, 2022
1 parent 210487d commit f64702a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func (d *Database) doOneMigration(ctx context.Context, m Migration) (bool, error
})
}
if err := d.driver.IsMigrationSupported(d, d.log, m); err != nil {
d.log.Debug(" migration not supported", map[string]interface{}{
"error": err.Error(),
})
return false, err
}
if m.Base().skipIf != nil {
Expand All @@ -229,22 +232,29 @@ func (d *Database) doOneMigration(ctx context.Context, m Migration) (bool, error
return false, errors.Wrapf(err, "SkipIf %s", m.Base().Name)
}
if skip {
d.log.Debug(" skipping migration")
return false, nil
}
d.log.Debug(" not skipping migration")
}
if m.Base().skipRemainingIf != nil {
skip, err := m.Base().skipRemainingIf()
if err != nil {
return false, errors.Wrapf(err, "SkipRemainingIf %s", m.Base().Name)
}
if skip {
d.log.Debug(" skipping remaining migrations")
return true, nil
}
d.log.Debug(" not skipping remaining migrations")
}
var repeatCount int
for {
result, err := d.driver.DoOneMigration(ctx, d.log, d, m)
if err != nil && d.Options.OnMigrationFailure != nil {
d.log.Debug(" migration failed", map[string]interface{}{
"error": err.Error(),
})
d.Options.OnMigrationFailure(d, m.Base().Name, err)
}
if m.Base().repeatUntilNoOp && err == nil && result != nil {
Expand Down

0 comments on commit f64702a

Please sign in to comment.