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/post_migrate/20230116090920_add_index_to_events_on_group_id_and_id.rb')
-rw-r--r--db/post_migrate/20230116090920_add_index_to_events_on_group_id_and_id.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/post_migrate/20230116090920_add_index_to_events_on_group_id_and_id.rb b/db/post_migrate/20230116090920_add_index_to_events_on_group_id_and_id.rb
new file mode 100644
index 00000000000..4c2a9af7df9
--- /dev/null
+++ b/db/post_migrate/20230116090920_add_index_to_events_on_group_id_and_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexToEventsOnGroupIdAndId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_events_on_group_id_and_id'
+
+ def up
+ add_concurrent_index :events, %i[group_id id], name: INDEX_NAME, where: 'group_id IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index_by_name :events, INDEX_NAME
+ end
+end