blob: ea92f9cfd32d40ebd248d35de2651940f5da1c53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'
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
|