Skip to content
Snippets Groups Projects
Commit 58c4ca27 authored by Adam Hegyi's avatar Adam Hegyi
Browse files

Merge branch '373455-redo-async-index-for-default-branch-image' into 'master'

Recreate async index for vulnerability reads location image

See merge request !103016



Merged-by: Adam Hegyi's avatarAdam Hegyi <ahegyi@gitlab.com>
Approved-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
Approved-by: Adam Hegyi's avatarAdam Hegyi <ahegyi@gitlab.com>
Co-authored-by: Alan (Maciej) Paruszewski's avatarAlan (Maciej) Paruszewski <mparuszewski@gitlab.com>
parents 50e48a2f a8e2d24c
No related branches found
No related tags found
1 merge request!103016Recreate async index for vulnerability reads location image
Pipeline #685831713 failed
# frozen_string_literal: true
class RecreateAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
def up
remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
prepare_async_index :vulnerability_reads, :location_image,
name: INDEX_NAME,
using: :gin, opclass: { location_image: :gin_trgm_ops },
where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
end
def down
unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
end
end
1d7912409bb5afc7de82b7507fb2aeb164253c70a58eaf88d502513577bad979
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment