Skip to content
Merged
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
3 changes: 2 additions & 1 deletion oryx/popx/migration_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ func WithTestdata(t *testing.T, testdata fs.FS) MigrationBoxOption {
if err != nil {
return err
}
if info.IsDir() {
if !info.Type().IsRegular() {
t.Logf("skipping testdata entry that is not a file: %s", path)
return nil
}

Expand Down
12 changes: 7 additions & 5 deletions oryx/popx/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func (mb *MigrationBox) Down(ctx context.Context, steps int) (err error) {

reverted := 0
defer func() {
mb.l.Debugf("Successfully reverted %d migrations.", reverted)
migrationsToRevertCount := min(steps, len(mfs))
mb.l.Debugf("Successfully reverted %d/%d migrations.", reverted, migrationsToRevertCount)
if err != nil {
mb.l.WithError(err).Error("Problem reverting migrations.")
}
Expand All @@ -174,6 +175,7 @@ func (mb *MigrationBox) Down(ctx context.Context, steps int) (err error) {
break
}
l := mb.l.WithField("version", mi.Version).WithField("migration_name", mi.Name).WithField("migration_file", mi.Path)
l.Debugf("handling migration %s", mi.Name)
exists, err := c.Where("version = ?", mi.Version).Exists(mtn)
if err != nil {
return errors.Wrapf(err, "problem checking for migration version %s", mi.Version)
Expand All @@ -194,7 +196,7 @@ func (mb *MigrationBox) Down(ctx context.Context, steps int) (err error) {
}

if err := mi.Valid(); err != nil {
return err
return errors.WithStack(err)
}

if mb.shouldNotUseTransaction(mi) {
Expand All @@ -211,7 +213,7 @@ func (mb *MigrationBox) Down(ctx context.Context, steps int) (err error) {
if err := mb.isolatedTransaction(ctx, "down", func(conn *pop.Connection) error {
err := mi.Runner(mi, conn)
if err != nil {
return err
return errors.WithStack(err)
}

// #nosec G201 - mtn is a system-wide const
Expand All @@ -221,11 +223,11 @@ func (mb *MigrationBox) Down(ctx context.Context, steps int) (err error) {

return nil
}); err != nil {
return err
return errors.WithStack(err)
}
}

l.Infof("< %s applied successfully", mi.Name)
l.Infof("%s applied successfully", mi.Name)
reverted++
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions oryx/randx/strength/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down