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

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

# Removes temporary index to fix orphan promoted issues.
# For more information check: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23916
class RemoveTemporaryPromotedNotesIndex < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    remove_concurrent_index_by_name :notes, 'tmp_idx_on_promoted_notes'
  end

  def down
    add_concurrent_index :notes,
      :note,
      where: "noteable_type = 'Issue' AND system IS TRUE AND note LIKE 'promoted to epic%'",
      name: 'tmp_idx_on_promoted_notes'
  end
end