2017-08-17 22:00:37 +05:30
|
|
|
# rubocop:disable RemoveIndex
|
2018-12-23 12:14:25 +05:30
|
|
|
class RemoveKeysFingerprintIndexIfExists < ActiveRecord::Migration[4.2]
|
2016-06-22 15:30:34 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/250
|
|
|
|
# That MR was added on gitlab-ee so we need to check if the index
|
|
|
|
# already exists because we want to do is create an unique index instead.
|
|
|
|
|
|
|
|
def up
|
|
|
|
if index_exists?(:keys, :fingerprint)
|
|
|
|
remove_index :keys, :fingerprint
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
unless index_exists?(:keys, :fingerprint)
|
|
|
|
add_concurrent_index :keys, :fingerprint
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|