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/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb')
-rw-r--r--db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb b/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb
new file mode 100644
index 00000000000..e2bca2fae1a
--- /dev/null
+++ b/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddAsyncIndexToTodosToCoverPendingQuery < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_on_todos_user_project_target_and_state'
+ COLUMNS = %i[user_id project_id target_type target_id id].freeze
+
+ def up
+ prepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'"
+ end
+
+ def down
+ unprepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state='pending'"
+ end
+end