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

20 lines
423 B
Ruby
Raw Normal View History

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