diff --git a/migrate.go b/migrate.go index 22769ffc5..5ef8b868d 100644 --- a/migrate.go +++ b/migrate.go @@ -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) + } + return 0, nil } // The most recent record for each migration specifies // whether it has been applied or rolled back.