summaryrefslogtreecommitdiff
path: root/db/migrate/20210114033715_remove_group_id_title_index.rb
blob: 8d63da3d4001437d32738b727f27840d3d432754 (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 RemoveGroupIdTitleIndex < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'index_labels_on_group_id_and_title_with_null_project_id'
  LABELS_TABLE = :labels

  def up
    remove_concurrent_index_by_name LABELS_TABLE, INDEX_NAME
  end

  def down
    add_concurrent_index LABELS_TABLE, [:group_id, :title], where: 'project_id IS NULL', name: INDEX_NAME
  end
end