blob: 9ed60941c962cbdd66afe1a9e7ff2f48af2f17d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# frozen_string_literal: true
class AddIndexToSbomOccurrencesLicenses < Gitlab::Database::Migration[2.1]
INDEX_NAME = "index_sbom_occurrences_on_licenses_spdx_identifier"
disable_ddl_transaction!
def up
return if index_exists_by_name?(:sbom_occurrences, INDEX_NAME)
disable_statement_timeout do
execute <<~SQL
CREATE INDEX CONCURRENTLY #{INDEX_NAME}
ON sbom_occurrences
USING BTREE (project_id, (licenses#>'{0,spdx_identifier}'), (licenses#>'{1,spdx_identifier}'))
SQL
end
end
def down
remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME
end
end
|