Add root_account_id to content_participations

Closes PLAT-5562
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  ContentParticipation record
- Verify ContentParticipation always live on
  the same shard as their root account

Change-Id: Ia7e766c3633f0864ba1158e71e7d47b9573dc9cb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233680
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
wdransfield 2020-04-10 09:57:17 -06:00 committed by Weston Dransfield
parent 3a17697986
commit f5026b1bf3
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify
# the terms of the GNU Affero General Public License as publishe
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but
# WARRANTY; without even the implied warranty of MERCHANTABILITY
# A PARTICULAR PURPOSE. See the GNU Affero General Public Licens
# details.
#
# You should have received a copy of the GNU Affero General Publ
# with this program. If not, see <http://www.gnu.org/licenses/>.
class AddRootAccountIdToContentParticipations < ActiveRecord::Migration[5.2]
tag :predeploy
disable_ddl_transaction!
def change
add_column :content_participations, :root_account_id, :integer, limit: 8
add_foreign_key :content_participations, :accounts, column: :root_account_id
add_index :content_participations, :root_account_id, algorithm: :concurrently
end
end