blob: 13f30b5ef6e7a2a5ee654b52ca70ce8e9d316bcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
class RecreateIndexOnVulnerabilityReads < Gitlab::Database::Migration[2.1]
OLD_INDEX_NAME = "index_vulnerability_reads_common_finder_query"
NEW_INDEX_NAME = "index_vulnerability_reads_common_finder_query_2"
disable_ddl_transaction!
def up
add_concurrent_index(
:vulnerability_reads,
%i[project_id state report_type severity vulnerability_id dismissal_reason],
name: NEW_INDEX_NAME,
order: { vulnerability_id: :desc }
)
remove_concurrent_index_by_name(
:vulnerability_reads,
OLD_INDEX_NAME
)
end
def down
add_concurrent_index(
:vulnerability_reads,
%i[project_id state report_type severity vulnerability_id],
name: OLD_INDEX_NAME,
order: { vulnerability_id: :desc }
)
remove_concurrent_index_by_name(
:vulnerability_reads,
NEW_INDEX_NAME
)
end
end
|