-
-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
This is meant to be a cautionary tale for other users, maybe it can be a documentation change once we agree on how this should be presented. The index reapplication worked as expected, keeping only the appropriate indexes after the update. I then noticed a mistake and rolled back the migration before fixing it and migrating again, the "fix" allowed an index that was dropped previously to stay, but it was no longer on the DB because it was dropped earlier. The add_index call was many migrations back, even worse this was the unique index, needed for my periodic refresh_materialized_view with concurrently: true call.
I had to manually run:
ActiveRecord::Migration.add_index :view_name, :id, unique: truePossible workarounds?
- Have
update_viewwhitelist which indexes can be dropped (less magic) but less prone for errors. - Have
update_viewscream (maybe it did, but I didn't notice) when dropping an index. - Have
update_viewsave the dropped index, to be created when rolling back? This one I have no idea on how it would work
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels