add root_account_id to content_shares

closes PLAT-5563
flag=none

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

Change-Id: I3261791c49996047296b23c555eeb325d4cc8826
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236932
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
This commit is contained in:
Xander Moffatt 2020-05-11 12:23:50 -06:00
parent c0c3130b70
commit ebd86d2497
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 AddRootAccountIdToContentShares < ActiveRecord::Migration[5.2]
include MigrationHelpers::AddColumnAndFk
tag :predeploy
disable_ddl_transaction!
def up
add_column_and_fk :content_shares, :root_account_id, :accounts
add_index :content_shares, :root_account_id, algorithm: :concurrently
end
def down
remove_column :content_shares, :root_account_id
end
end