BigW Consortium Gitlab

20160412173418_add_ci_commit_indexes.rb 445 Bytes
Newer Older
1
# rubocop:disable all
2
class AddCiCommitIndexes < ActiveRecord::Migration
3 4
  disable_ddl_transaction!

5
  def change
6 7 8 9 10
    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

11 12
  private

13
  def index_options
14 15 16 17 18
    if Gitlab::Database.postgresql?
      { algorithm: :concurrently }
    else
      { }
    end
19 20
  end
end