gitlab-org--gitlab-foss/db/migrate/20150306023112_add_unique_index_to_namespace.rb

10 lines
338 B
Ruby
Raw Normal View History

2015-03-06 09:39:20 -05:00
class AddUniqueIndexToNamespace < ActiveRecord::Migration
def change
2015-03-06 14:09:14 -05:00
remove_index :namespaces, column: :name if index_exists?(:namespaces, :name)
remove_index :namespaces, column: :path if index_exists?(:namespaces, :path)
2015-03-06 09:39:20 -05:00
add_index :namespaces, :name, unique: true
add_index :namespaces, :path, unique: true
end
end