Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20201201034258_add_index_for_non_system_noteables.rb')
-rw-r--r--db/migrate/20201201034258_add_index_for_non_system_noteables.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20201201034258_add_index_for_non_system_noteables.rb b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb
new file mode 100644
index 00000000000..5927463e767
--- /dev/null
+++ b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb
@@ -0,0 +1,24 @@
+# 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