Background migration to fix incorrect `has_issues` columns on `vulnerability_reads`

Why are we doing this work

In #386434 (closed) we fixed a bug where the has_issues column on the vulnerability_reads table could be set incorrectly when the record was created. We need to write a background migration in order to fix the existing records.

Relevant links

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

Write a background migration that:

  1. Iterates through all vulnerability_reads records where has_issues = false
  2. Check if there are any vulnerability links associated with the vulnerability. If so, update has_issues to true

Verification steps

Edited by Brian Williams