BigW Consortium Gitlab

20150306023112_add_unique_index_to_namespace.rb 360 Bytes
Newer Older
1
# rubocop:disable all
Valery Sizov committed
2 3
class AddUniqueIndexToNamespace < ActiveRecord::Migration
  def change
Valery Sizov committed
4 5
    remove_index :namespaces, column: :name if index_exists?(:namespaces, :name)
    remove_index :namespaces, column: :path if index_exists?(:namespaces, :path)
Valery Sizov committed
6 7 8 9 10

    add_index :namespaces, :name, unique: true
    add_index :namespaces, :path, unique: true
  end
end