Commit 3a4b5218 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '276943-add-non-system-index-to-notes' into 'master'

Add `system` to existing index for notes

See merge request gitlab-org/gitlab!48864
parents dda8fa45 512fd434
---
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
......@@ -21795,7 +21795,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_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);
......
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