Set up replica identity index for lti line items

closes INTEROP-6356
flag=none

Test plan
- Verify that the replica identity index has been
  created
- Verify the replica identity for lti_line_items
  has been set to index (SELECT relname, relreplident
  FROM pg_class WHERE relname = 'lti_line_items';)
- Ensure the old root_account_id index has been
  removed for the table

Change-Id: I93b89f9b3c848f0902f5db71252a360962974431
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253274
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
This commit is contained in:
Mysti Lilla 2020-11-12 16:54:30 -07:00
parent 6a53b0fcd3
commit 3712a4c1de
2 changed files with 34 additions and 14 deletions

View File

@ -0,0 +1,34 @@
# frozen_string_literal: true
#
# 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 AddReplicaIdentityForLtiLineItems < ActiveRecord::Migration[5.2]
tag :postdeploy
disable_ddl_transaction!
def up
add_replica_identity 'Lti::LineItem', :root_account_id, 0
remove_index :lti_line_items, name: 'index_lti_line_items_on_root_account_id', if_exists: true
end
def down
add_index :lti_line_items, :root_account_id, algorithm: :concurrently, if_not_exists: true
remove_replica_identity 'Lti::LineItem'
change_column_null :lti_line_items, :root_account_id, true
end
end

View File

@ -702,13 +702,6 @@ describe DataFixup::PopulateRootAccountIdOnModels do
end
end
context 'with Lti::LineItem' do
it_behaves_like 'a datafixup that populates root_account_id' do
let(:record) { line_item_model(course: @course) }
let(:reference_record) { @course }
end
end
context 'with learning outcomes' do
let(:outcome) { outcome_model }
let(:alignment) { outcome.align(assignment, @course) }
@ -769,13 +762,6 @@ describe DataFixup::PopulateRootAccountIdOnModels do
end
end
context 'with Lti::LineItem' do
it_behaves_like 'a datafixup that populates root_account_id' do
let(:record) { line_item_model(course: @course) }
let(:reference_record) { @course }
end
end
context 'with MasterCourses::*' do
let(:content_migration) { @course.content_migrations.create!(user: @user) }
let(:child_course) { course_model(account: @course.account) }