2023-07-12 07:47:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-23 15:46:00 +00:00
|
|
|
class AddStatusesIndexOnAccountIdId < ActiveRecord::Migration[5.1]
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def change
|
|
|
|
# Statuses queried by account_id are often sorted by id. Querying statuses
|
|
|
|
# of an account to show them in his status page is one of the most
|
|
|
|
# significant examples.
|
|
|
|
# Add this index to improve the performance in such cases.
|
2023-02-20 05:14:10 +00:00
|
|
|
add_index 'statuses', %w(account_id id), algorithm: :concurrently, name: 'index_statuses_on_account_id_id'
|
2017-06-23 15:46:00 +00:00
|
|
|
|
|
|
|
remove_index 'statuses', algorithm: :concurrently, column: 'account_id', name: 'index_statuses_on_account_id'
|
|
|
|
end
|
|
|
|
end
|