summaryrefslogtreecommitdiff
path: root/db/migrate/20160412173418_add_ci_commit_indexes.rb
blob: 709e6b84d5765b7840bb949ec6e2a5df107b55bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# rubocop:disable all
class AddCiCommitIndexes < ActiveRecord::Migration[4.2]
  disable_ddl_transaction!

  def change
    add_index :ci_commits, [:gl_project_id, :sha], index_options
    add_index :ci_commits, [:gl_project_id, :status], index_options
    add_index :ci_commits, [:status], index_options
  end

  private

  def index_options
    if Gitlab::Database.postgresql?
      { algorithm: :concurrently }
    else
      { }
    end
  end
end