Add root_account_id to grading_standards

Closes PLAT-5545
flag=none

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

Change-Id: I82f4ec0f897e5116d6d7552816cdd9c83af4e117
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235206
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
wdransfield 2020-04-24 10:11:43 -06:00 committed by Weston Dransfield
parent 301df47a40
commit 3dc05d1873
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 AddRootAccountIdToGradingStandards < ActiveRecord::Migration[5.2]
include MigrationHelpers::AddColumnAndFk
tag :predeploy
disable_ddl_transaction!
def up
add_column_and_fk :grading_standards, :root_account_id, :accounts
add_index :grading_standards, :root_account_id, algorithm: :concurrently
end
def down
remove_column :grading_standards, :root_account_id
end
end