summaryrefslogtreecommitdiff
path: root/db/migrate/20160412173418_add_ci_commit_indexes.rb
blob: 603d4a4161088ca631c7481aa053867cba40fba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class AddCiCommitIndexes < ActiveRecord::Migration
  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