From f64702ac629d14da467dcac56fda3fecf5418b70 Mon Sep 17 00:00:00 2001 From: David Sharnoff Date: Wed, 7 Dec 2022 20:33:07 -0800 Subject: [PATCH] add some debugging (#52) * add some debugging * lint --- apply.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apply.go b/apply.go index 58bb9ae..1f8c8e9 100644 --- a/apply.go +++ b/apply.go @@ -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 { @@ -229,8 +232,10 @@ 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() @@ -238,13 +243,18 @@ func (d *Database) doOneMigration(ctx context.Context, m Migration) (bool, error 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 {