gitlab-org--gitlab-foss/db/migrate/20160301174731_add_fingerprint_index.rb

18 lines
390 B
Ruby
Raw Normal View History

# rubocop:disable all
class AddFingerprintIndex < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
DOWNTIME = false
2016-07-08 01:32:15 -04:00
# https://gitlab.com/gitlab-org/gitlab-ee/issues/764
def change
args = [:keys, :fingerprint]
if Gitlab::Database.postgresql?
args << { algorithm: :concurrently }
end
2016-07-08 01:32:15 -04:00
add_index(*args) unless index_exists?(:keys, :fingerprint)
end
end