20171125190735_remove_old_reblog_index_on_statuses.rb 450 B

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