add root_account_id to discussion_topics

closes PLAT-5776
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  DiscussionTopic record
* verify DiscussionTopic always
  live on the same shard as their root account

Change-Id: I18c6e815490abea9633d466f2d8213f4894f8eae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236956
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
This commit is contained in:
Xander Moffatt 2020-05-11 13:47:32 -06:00
parent 2daa198644
commit 6961fc81aa
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 AddRootAccountIdToDiscussionTopics < ActiveRecord::Migration[5.2]
include MigrationHelpers::AddColumnAndFk
tag :predeploy
disable_ddl_transaction!
def up
add_column_and_fk :discussion_topics, :root_account_id, :accounts
add_index :discussion_topics, :root_account_id, algorithm: :concurrently
end
def down
remove_column :discussion_topics, :root_account_id
end
end