Add some missing indexes on foreign keys (#18157)
parent
d55154819e
commit
9b4024a389
5 changed files with 34 additions and 1 deletions
@ -0,0 +1,7 @@ |
||||
class AddIndexStatusesOnAccountId < ActiveRecord::Migration[6.1] |
||||
disable_ddl_transaction! |
||||
|
||||
def change |
||||
add_index :statuses, [:account_id], name: :index_statuses_on_account_id, algorithm: :concurrently |
||||
end |
||||
end |
@ -0,0 +1,7 @@ |
||||
class AddIndexStatusesPinsOnStatusId < ActiveRecord::Migration[6.1] |
||||
disable_ddl_transaction! |
||||
|
||||
def change |
||||
add_index :status_pins, [:status_id], name: :index_status_pins_on_status_id, algorithm: :concurrently |
||||
end |
||||
end |
@ -0,0 +1,7 @@ |
||||
class AddIndexReportsOnAssignedAccountId < ActiveRecord::Migration[6.1] |
||||
disable_ddl_transaction! |
||||
|
||||
def change |
||||
add_index :reports, [:assigned_account_id], name: :index_reports_on_assigned_account_id, algorithm: :concurrently, where: 'assigned_account_id IS NOT NULL' |
||||
end |
||||
end |
@ -0,0 +1,7 @@ |
||||
class AddIndexReportsOnActionTakenByAccountId < ActiveRecord::Migration[6.1] |
||||
disable_ddl_transaction! |
||||
|
||||
def change |
||||
add_index :reports, [:action_taken_by_account_id], name: :index_reports_on_action_taken_by_account_id, algorithm: :concurrently, where: 'action_taken_by_account_id IS NOT NULL' |
||||
end |
||||
end |
Loading…
Reference in new issue