2016-06-09 08:39:16 -04:00
|
|
|
# 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
|