summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb')
-rw-r--r--db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb b/db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb
new file mode 100644
index 00000000000..313a31d8964
--- /dev/null
+++ b/db/post_migrate/20220425111453_add_async_index_to_events_on_group_id_and_id.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddAsyncIndexToEventsOnGroupIdAndId < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_events_on_group_id_and_id'
+
+ def up
+ prepare_async_index :events, %I[group_id id], name: INDEX_NAME, where: 'group_id IS NOT NULL'
+ end
+
+ def down
+ unprepare_async_index :events, %I[group_id id], name: INDEX_NAME, where: 'group_id IS NOT NULL'
+ end
+end