20170130204620_add_index_to_project_authorizations.rb 459 Bytes
Newer Older
1
# rubocop:disable RemoveIndex
2
class AddIndexToProjectAuthorizations < ActiveRecord::Migration[4.2]
3 4 5 6 7 8 9
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
10 11 12
    unless index_exists?(:project_authorizations, :project_id)
      add_concurrent_index(:project_authorizations, :project_id)
    end
13
  end
Lin Jen-Shin's avatar
Lin Jen-Shin committed
14 15

  def down
16 17
    remove_index(:project_authorizations, :project_id) if
      Gitlab::Database.postgresql?
Lin Jen-Shin's avatar
Lin Jen-Shin committed
18
  end
19
end