summaryrefslogtreecommitdiff
path: root/db/migrate/20220304062107_remove_unique_index_for_sprints_on_project_id_and_title.rb
blob: 34a357bdc5c13a41e1d7b054a27881c4fa7d7b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class RemoveUniqueIndexForSprintsOnProjectIdAndTitle < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_sprints_on_project_id_and_title'

  def up
    remove_concurrent_index_by_name :sprints, INDEX_NAME
  end

  def down
    add_concurrent_index :sprints, [:project_id, :title], where: "project_id IS NOT NULL", name: INDEX_NAME, unique: true
  end
end