summaryrefslogtreecommitdiff
path: root/db/migrate/20170130204620_add_index_to_project_authorizations.rb
blob: 28c4480e9c65a48efd94dc84cdf8f873fee2ba5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# rubocop:disable RemoveIndex
class AddIndexToProjectAuthorizations < ActiveRecord::Migration[4.2]
  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