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

20200211155100_add_temporary_merge_request_with_mentions_index.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5b25f29d5f7f20bdfb3c55b478db2d2a5ce4288b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class AddTemporaryMergeRequestWithMentionsIndex < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_CONDITION = "description like '%@%' OR title like '%@%'"
  INDEX_NAME = 'merge_request_mentions_temp_index'

  disable_ddl_transaction!

  def up
    # create temporary index for notes with mentions, may take well over 1h
    add_concurrent_index(:merge_requests, :id, where: INDEX_CONDITION, name: INDEX_NAME)
  end

  def down
    remove_concurrent_index(:merge_requests, :id, where: INDEX_CONDITION, name: INDEX_NAME)
  end
end