Commit 512fd434 authored by Kerri Miller's avatar Kerri Miller Committed by Andreas Brandl

Add `system` to existing index for notes

parent 3c2d7dc2
---
title: Update index for notes to include `system`
merge_request: 48864
author:
type: performance
# frozen_string_literal: true
class AddIndexForNonSystemNoteables < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
LEGACY_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type"
NEW_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type_and_system"
def up
add_concurrent_index :notes, [:noteable_id, :noteable_type, :system], name: NEW_INDEX_NAME
remove_concurrent_index_by_name :notes, LEGACY_INDEX_NAME
end
def down
add_concurrent_index :notes, [:noteable_id, :noteable_type], name: LEGACY_INDEX_NAME
remove_concurrent_index_by_name :notes, NEW_INDEX_NAME
end
end
12cc1beb73bcc31f6546066842913284aabba22ea4e93095271c0cfdacfd0858
\ No newline at end of file
...@@ -21734,7 +21734,7 @@ CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code); ...@@ -21734,7 +21734,7 @@ CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code);
CREATE INDEX index_notes_on_note_trigram ON notes USING gin (note gin_trgm_ops); CREATE INDEX index_notes_on_note_trigram ON notes USING gin (note gin_trgm_ops);
CREATE INDEX index_notes_on_noteable_id_and_noteable_type ON notes USING btree (noteable_id, noteable_type); CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system);
CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system); CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment