20171125190735_remove_old_reblog_index_on_statuses.rb 419 B

1234567891011121314
  1. class RemoveOldReblogIndexOnStatuses < ActiveRecord::Migration[5.1]
  2. disable_ddl_transaction!
  3. def up
  4. # This index may not exists (see migration 20171122120436)
  5. remove_index :statuses, [:account_id, :reblog_of_id] if index_exists?(:statuses, [:account_id, :reblog_of_id])
  6. remove_index :statuses, :reblog_of_id
  7. end
  8. def down
  9. add_index :statuses, :reblog_of_id, algorithm: :concurrently
  10. end
  11. end