Skip to content

Commit

Permalink
fix: migrator should skip down migrations that were not yet applied (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Jul 30, 2024
1 parent a232b37 commit a6c81be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions popx/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ func (m *Migrator) Down(ctx context.Context, steps int) error {
steps = min(steps, count)

mfs := m.Migrations["down"].SortAndFilter(c.Dialect.Name(), sort.Reverse)
if len(mfs) > count {
// skip all migrations that were not yet applied
mfs = mfs[len(mfs)-count:]
}

reverted := 0
defer func() {
Expand Down

0 comments on commit a6c81be

Please sign in to comment.