20190820003045_update_statuses_index.rb 638 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class UpdateStatusesIndex < ActiveRecord::Migration[5.2]
  3. disable_ddl_transaction!
  4. def up
  5. safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20190820 }
  6. remove_index :statuses, name: :index_statuses_20180106
  7. end
  8. def down
  9. safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 }
  10. remove_index :statuses, name: :index_statuses_20190820
  11. end
  12. end