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

20220905112710_add_async_index_to_todos_to_cover_pending_query.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2bca2fae1a60bf4a843bf9e6463922e2669e667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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