Fix missing `traversal_ids` for `vulnerability_reads` records
What does this MR do and why?
This migration sets the missing traversal_ids
for the vulnerability_reads
records. As of writing, there are 172 records in this condition on the production database.
Initial batching query
SELECT
"vulnerability_reads"."vulnerability_id"
FROM
"vulnerability_reads"
WHERE
"vulnerability_reads"."traversal_ids" = '{}'
AND "vulnerability_reads"."archived" = FALSE
ORDER BY
"vulnerability_reads"."vulnerability_id" ASC
LIMIT 1
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/29050/commands/90509
An example update query
UPDATE
vulnerability_reads
SET
traversal_ids = namespaces.traversal_ids
FROM
namespaces
WHERE
vulnerability_reads.vulnerability_id IN (100000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009, 100010, 100011, 100012, 100013, 100014, 100015, 100016, 100017, 100018, 100019, 100020, 100021, 100022, 100023, 100024, 100025, 100026, 100027, 100028, 100029, 100030, 100031, 100032, 100033, 100034, 100035, 100036, 100037, 100038, 100039, 100040, 100041, 100042, 100043, 100044, 100045, 100046, 100047, 100048, 100049)
AND namespaces.id = vulnerability_reads.namespace_id
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/29050/commands/90508
Edited by Mehmet Emin INAC