Skip to content

Commit

Permalink
fix: upgrades (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag authored Sep 7, 2023
2 parents e9e2edd + 3a64921 commit 44d6a1f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions libs/go-libs/migrations/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ func (m *Migrator) Up(ctx context.Context, db *bun.DB) error {
return err
}

for ind, migration := range m.migrations[lastMigration:] {
if err := migration.Up(tx); err != nil {
return err
}

if err := m.insertVersion(ctx, tx, int(lastMigration)+ind+1); err != nil {
return err
if len(m.migrations) > int(lastMigration)-1 {
for ind, migration := range m.migrations[lastMigration:] {
if err := migration.Up(tx); err != nil {
return err
}

if err := m.insertVersion(ctx, tx, int(lastMigration)+ind+1); err != nil {
return err
}
}
}

Expand Down

1 comment on commit 44d6a1f

@vercel
Copy link

@vercel vercel bot commented on 44d6a1f Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.