20170130204620_add_index_to_project_authorizations.rb 424 Bytes
Newer Older
1 2 3 4 5 6 7 8
class AddIndexToProjectAuthorizations < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

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

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