2016-06-09 08:39:16 -04:00
|
|
|
# rubocop:disable all
|
2018-11-13 02:27:31 -05:00
|
|
|
class AddCiCommitIndexes < ActiveRecord::Migration[4.2]
|
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
|