Check if index exists before adding it. [ci skip]

* I got an error when updating GDK because it already exists.
This commit is contained in:
Rubén Dávila 2016-03-21 21:16:37 -05:00
parent 3a78f7caa0
commit cbdbbcbc4f
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,7 @@
class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration
def change
add_index :namespaces, :visibility_level
unless index_exists?(:namespaces, :visibility_level)
add_index :namespaces, :visibility_level
end
end
end