summaryrefslogtreecommitdiff
path: root/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
blob: 4af42b4fb298d58302233021e6824566d6738ce2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class AddIndexesToRemoteMirror < ActiveRecord::Migration
  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