Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return joined err when try to get migrations list #862

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ func EnsureDBVersion(db *sql.DB) (int64, error) {
func EnsureDBVersionContext(ctx context.Context, db *sql.DB) (int64, error) {
dbMigrations, err := store.ListMigrations(ctx, db, TableName())
if err != nil {
return 0, createVersionTable(ctx, db)
createErr := createVersionTable(ctx, db)
if createErr != nil {
return 0, errors.Join(err, createErr)
Copy link
Collaborator

@mfridman mfridman Jan 29, 2025

Choose a reason for hiding this comment

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

Use go.uber.org/multierr for consistency (rest of the code base does not use errors.Join).

At some point we'll switch over to errors.Join, but until then, would prefer consistency so it's easier to refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
return 0, nil
}
// The most recent record for each migration specifies
// whether it has been applied or rolled back.
Expand Down