Skip to content

Commit

Permalink
fix: upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Sep 7, 2023
1 parent e9e2edd commit 3a64921
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

0 comments on commit 3a64921

Please sign in to comment.