summaryrefslogtreecommitdiff
path: root/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
blob: bdf05c4e69b4f5f2e764add2abda15d8c559a18a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class AddIndexesToRemoteMirror < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :remote_mirrors, :last_successful_update_at unless index_exists?(:remote_mirrors, :last_successful_update_at)
  end

  def down
    # rubocop:disable Migration/RemoveIndex
    remove_index :remote_mirrors, :last_successful_update_at if index_exists? :remote_mirrors, :last_successful_update_at
  end
end