You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Something < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_reference :users, :email, index: { algorithm: :concurrently }
end
end
Effectively it does the following:
turns off the transaction (for index)
adds column
creates index
However, if something goes wrong and migration will fail during the index creation—there will be a weird state: migration is rolled back, column is created, index is not created/created with error.
Do I miss something? I'd be happy to add a new rule for that
The text was updated successfully, but these errors were encountered:
DmitryTsepelev
changed the title
add_reference + index +disable_ddl_transaction!
add_reference + index +disable_ddl_transaction! is an unsafe pattern?
Aug 30, 2023
Hey!
Looks like I found an interesting behavior:
Effectively it does the following:
However, if something goes wrong and migration will fail during the index creation—there will be a weird state: migration is rolled back, column is created, index is not created/created with error.
Do I miss something? I'd be happy to add a new rule for that
The text was updated successfully, but these errors were encountered: