2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
2021-03-08 18:12:59 +05:30
|
|
|
INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
add_concurrent_index :deployments, [:project_id, :ref]
|
|
|
|
add_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_concurrent_index :deployments, [:project_id, :ref]
|
|
|
|
remove_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME
|
|
|
|
end
|
|
|
|
end
|