add root_account_id to enrollment_states

closes PLAT-5582

test plan:
* verify migrations run
* verify root_account_id can be set on an EnrollmentState
* verify EnrollmentStates_s live on the same shard as their root account

Change-Id: I4a51d590dd0d3aa0200efbea88e3266b1b8325d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235723
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Xander Moffatt 2020-04-29 16:16:46 -06:00
parent e510c61fc9
commit 5a8a206f65
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
class AddRootAccountIdToEnrollmentStates < ActiveRecord::Migration[5.2]
include MigrationHelpers::AddColumnAndFk
tag :predeploy
disable_ddl_transaction!
def up
add_column_and_fk :enrollment_states, :root_account_id, :accounts
add_index :enrollment_states, :root_account_id, algorithm: :concurrently
end
def down
remove_column :enrollment_states, :root_account_id
end
end