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

class AddUniqueNamespacesIndexOnNameParentIdAndType < Gitlab::Database::Migration[1.0]
  INDEX_NAME = 'index_namespaces_name_parent_id_type'

  disable_ddl_transaction!

  def up
    add_concurrent_index :namespaces, [:name, :parent_id, :type], unique: true, name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :namespaces, INDEX_NAME
  end
end