20160301174731_add_fingerprint_index.rb 390 Bytes
Newer Older
1
# rubocop:disable all
2
class AddFingerprintIndex < ActiveRecord::Migration[4.2]
3 4 5 6
  disable_ddl_transaction!

  DOWNTIME = false

7
  # https://gitlab.com/gitlab-org/gitlab-ee/issues/764
8 9 10 11 12 13 14
  def change
    args = [:keys, :fingerprint]

    if Gitlab::Database.postgresql?
      args << { algorithm: :concurrently }
    end

15
    add_index(*args) unless index_exists?(:keys, :fingerprint)
16 17
  end
end