0
0
Fork 0

Add some missing indexes on foreign keys (#18157)

This commit is contained in:
Claire 2022-04-28 17:15:11 +02:00 committed by GitHub
parent d55154819e
commit 9b4024a389
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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