summaryrefslogtreecommitdiff
path: root/db/migrate/20160301174731_add_fingerprint_index.rb
blob: f2c3d1ba1eadbcc79bf6fdeb3ad18a74e1745d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# rubocop:disable all
class AddFingerprintIndex < ActiveRecord::Migration
  disable_ddl_transaction!

  DOWNTIME = false

  # https://gitlab.com/gitlab-org/gitlab-ee/issues/764
  def change
    args = [:keys, :fingerprint]

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

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