blob: 19100e1d0cc048989ff6b4e8164d324e6a061a9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
class AddTmpIndexVulnsOnReportType < Gitlab::Database::Migration[2.0]
# Temporary index to perform migration removing invalid vulnerabilities
INDEX_NAME = 'tmp_idx_vulnerabilities_on_id_where_report_type_7_99'
REPORT_TYPES = {
cluster_image_scanning: 7,
custom: 99
}
disable_ddl_transaction!
def up
add_concurrent_index :vulnerabilities, :id,
where: "report_type IN (#{REPORT_TYPES.values.join(', ')})",
name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
end
end
|