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

Add missing index renaming when completing a migration #577

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions pkg/migrations/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ func RenameDuplicatedColumn(ctx context.Context, conn db.DB, table *schema.Table
if err != nil {
return fmt.Errorf("failed to rename index %q: %w", idx.Name, err)
}

// Index no longer exists, remove it from the table
delete(table.Indexes, idx.Name)
}

if _, ok := table.UniqueConstraints[StripDuplicationPrefix(idx.Name)]; idx.Unique && ok {
Expand All @@ -154,8 +157,6 @@ func RenameDuplicatedColumn(ctx context.Context, conn db.DB, table *schema.Table
}
}

// Index no longer exists, remove it from the table
delete(table.Indexes, idx.Name)
}

return nil
Expand Down