mirror of
https://github.com/instructure/canvas-lms.git
synced 2026-03-09 21:47:48 +08:00
Add composite index to discussion_topics table
closes VICE-5723 flag=none Fixes slow queries when filtering by context and assignment see DiscussionTopicsController#index:335 Test Plan: - Jenkins passes - Verify migration runs successfully - index works Change-Id: I4a8cb264d6449e875ef430fc2910d812be4bcb6e Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/401014 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Migration-Review: Isaac Moore <isaac.moore@instructure.com> Reviewed-by: Norbert Zsolt Bakó <norbert.bako@instructure.com> QA-Review: Theo Sorriaux <theo.sorriaux@instructure.com> Product-Review: Theo Sorriaux <theo.sorriaux@instructure.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# Copyright (C) 2026 - 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 AddContextIdIdIndexToDiscussionTopics < ActiveRecord::Migration[8.0]
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :discussion_topics,
|
||||
[:context_id, :id],
|
||||
name: "index_discussion_topics_on_context_id_and_id",
|
||||
algorithm: :concurrently,
|
||||
if_not_exists: true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user