[migration] make this index creation conditional

This commit is contained in:
Fosco Marotto 2020-12-12 16:46:53 -08:00
parent 532bac229a
commit f0d4e89279
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@ class AddIndexToStatusesReply < ActiveRecord::Migration[5.2]
disable_ddl_transaction! disable_ddl_transaction!
def change def change
add_index :statuses, :reply, algorithm: :concurrently if !index_exists?(:statuses, :reply)
add_index :statuses, :reply, algorithm: :concurrently
end
end end
end end