about summary refs log tree commit diff
path: root/db/migrate/20210425135952_add_index_on_media_attachments_account_id_status_id.rb
blob: 5ef2d3c398ec86e95b634ffcced6eb6f6e7ea2f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
class AddIndexOnMediaAttachmentsAccountIdStatusId < ActiveRecord::Migration[5.2]
  disable_ddl_transaction!

  def up
    add_index :media_attachments, [:account_id, :status_id], order: { status_id: :desc }, algorithm: :concurrently
    remove_index :media_attachments, :account_id, algorithm: :concurrently
  end

  def down
    add_index :media_attachments, :account_id, algorithm: :concurrently
    remove_index :media_attachments, [:account_id, :status_id], order: { status_id: :desc }, algorithm: :concurrently
  end
end