Skip to content
Snippets Groups Projects
Commit e3047d15 authored by Michał Zając's avatar Michał Zając Committed by Mayra Cabrera
Browse files

Create index on security_findings asynchronously

We need an (uuid, id DESC) index on security_findings so that our new
Vulnerabilities::Finding creation service object doesn't timeout.

The timeout can occur when trying to fetch a security_findings rows via
an UUID because we have a UNIQUE index on (uuid, scan_id) which models
the possibility of finding the same exact vulnerability in subsequent
scans.

Changelog: added
parent 720982af
No related branches found
No related tags found
1 merge request!91884Create index on security_findings asynchronously
# frozen_string_literal: true
class CreateAsyncIndexOnSecurityFindings < Gitlab::Database::Migration[2.0]
INDEX_NAME = 'index_on_security_findings_uuid_and_id_order_desc'
def up
prepare_async_index(
:security_findings,
%i[uuid id],
order: { id: :desc },
name: INDEX_NAME
)
end
def down
unprepare_async_index(
:security_findings,
%i[uuid id],
name: INDEX_NAME
)
end
end
c0c4a18cb711e0288bf1d385e06151e0e329dc40d4e9cd51e6437fe73d6bfc21
\ 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