switch some migrations to add FK with the column to avoid locking

Change-Id: Icea0c41f49642f9da2c22a6df80066e69e80b125
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239703
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Cody Cutrer 2020-06-09 14:35:28 -06:00
parent ec32fbefe1
commit e760c87d7e
3 changed files with 6 additions and 6 deletions

View File

@ -17,9 +17,9 @@
class AddRootAccountIdToLtiLineItems < ActiveRecord::Migration[5.2]
tag :predeploy
include MigrationHelpers::AddColumnAndFk
def change
add_column :lti_line_items, :root_account_id, :integer, limit: 8, if_not_exists: true
add_foreign_key :lti_line_items, :accounts, column: :root_account_id, if_not_exists: true
add_column_and_fk :lti_line_items, :root_account_id, :accounts, if_not_exists: true
end
end

View File

@ -18,9 +18,9 @@
class AddRootAccountIdToContentParticipations < ActiveRecord::Migration[5.2]
tag :predeploy
disable_ddl_transaction!
include MigrationHelpers::AddColumnAndFk
def change
add_column :content_participations, :root_account_id, :integer, limit: 8, if_not_exists: true
add_foreign_key :content_participations, :accounts, column: :root_account_id, if_not_exists: true
add_column_and_fk :content_participations, :root_account_id, :accounts, if_not_exists: true
end
end

View File

@ -18,9 +18,9 @@
class AddRootAccountIdToContentParticipationCounts < ActiveRecord::Migration[5.2]
tag :predeploy
disable_ddl_transaction!
include MigrationHelpers::AddColumnAndFk
def change
add_column :content_participation_counts, :root_account_id, :integer, limit: 8, if_not_exists: true
add_foreign_key :content_participation_counts, :accounts, column: :root_account_id, if_not_exists: true
add_column_and_fk :content_participation_counts, :root_account_id, :accounts, if_not_exists: true
end
end