Skip to content

Commit

Permalink
Fix DB migration
Browse files Browse the repository at this point in the history
`testpgx` handled this for us before, but I forgot that `migrate.Up()` returns an `ErrNoChange` error when there's no migrations to apply, which is annoying and causes `:run_db` to fail
  • Loading branch information
bcspragu committed Jan 18, 2024
1 parent 50b5350 commit 9d759a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/tools/migratesqldb/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ var (
if err != nil {
return fmt.Errorf("when creating the migrator: %w", err)
}
if err := migrator.Up(); err != nil {
if err := migrator.Up(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
return fmt.Errorf("while applying the migration(s): %w", err)
}

return nil
},
}
Expand Down

0 comments on commit 9d759a3

Please sign in to comment.