fedibird-fe/db/migrate/20210627041354_update_statuses_index_with_expired_at.rb

13 lines
662 B
Ruby

class UpdateStatusesIndexWithExpiredAt < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def up
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at, :expires_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20210627 }
remove_index :statuses, name: :index_statuses_20190820
end
def down
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 }
remove_index :statuses, name: :index_statuses_20210627
end
end