blob: ebb90df569bad5eb570a223efd867786dce50caf (
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 RemoveTmpIdxVulnerabilityOccurrencesOnIdAndScannerId < Gitlab::Database::Migration[2.0]
INDEX_NAME = 'tmp_index_vulnerability_occurrences_on_id_and_scanner_id'
REPORT_TYPES = { cluster_image_scanning: 7, generic: 99 }.freeze
CLAUSE = "report_type IN (#{REPORT_TYPES.values.join(',')})"
disable_ddl_transaction!
def up
remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME
end
def down
add_concurrent_index :vulnerability_occurrences,
[:id, :scanner_id],
where: CLAUSE,
name: INDEX_NAME
end
end
|