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

20221019194751_disable_fastupdate_on_issues_title_gin_index.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 64d935489c2a20bd4b587f94934aa8f57c431e7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

class DisableFastupdateOnIssuesTitleGinIndex < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_issues_on_title_trigram'

  def up
    return unless index_exists_by_name?(:issues, INDEX_NAME)

    with_lock_retries do
      execute <<~SQL
        ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
      SQL
    end
  end

  def down
    return unless index_exists_by_name?(:issues, INDEX_NAME)

    with_lock_retries do
      execute <<~SQL
        ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
      SQL
    end
  end
end