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/20220912085047_add_index_to_todos_pending_query.rb')
-rw-r--r--db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb b/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb
new file mode 100644
index 00000000000..7d721421463
--- /dev/null
+++ b/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddIndexToTodosPendingQuery < 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
+ add_concurrent_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'"
+ end
+
+ def down
+ remove_concurrent_index_by_name :todos, INDEX_NAME
+ end
+end