summaryrefslogtreecommitdiff
path: root/db/migrate/20170130204620_add_index_to_project_authorizations.rb
blob: 8c593c39440d6bf651648d89730bb4012e67672c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class AddIndexToProjectAuthorizations < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    unless index_exists?(:project_authorizations, :project_id)
      add_concurrent_index(:project_authorizations, :project_id)
    end
  end

  def down
    remove_index(:project_authorizations, :project_id) if
      Gitlab::Database.postgresql?
  end
end