Avoid adding index if already exists

This commit is contained in:
Paco Guzman 2016-07-08 07:32:15 +02:00 committed by James Edwards-Jones
parent 797fe0a6e6
commit d2f4e8f97d

View file

@ -4,6 +4,7 @@ class AddFingerprintIndex < ActiveRecord::Migration
DOWNTIME = false
# https://gitlab.com/gitlab-org/gitlab-ee/issues/764
def change
args = [:keys, :fingerprint]
@ -11,6 +12,6 @@ class AddFingerprintIndex < ActiveRecord::Migration
args << { algorithm: :concurrently }
end
add_index(*args)
add_index(*args) unless index_exists?(:keys, :fingerprint)
end
end