gitlab-org--gitlab-foss/db/migrate/20160412173418_add_ci_commi...

21 lines
445 B
Ruby
Raw Normal View History

# rubocop:disable all
2016-04-12 13:57:54 -04:00
class AddCiCommitIndexes < ActiveRecord::Migration
2016-04-13 09:40:26 -04:00
disable_ddl_transaction!
2016-04-12 13:57:54 -04:00
def change
2016-04-13 09:40:26 -04:00
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
2016-04-13 09:46:35 -04:00
private
2016-04-13 09:40:26 -04:00
def index_options
2016-04-13 10:14:27 -04:00
if Gitlab::Database.postgresql?
{ algorithm: :concurrently }
else
{ }
end
2016-04-12 13:57:54 -04:00
end
end