Skip to content

Fix Security features tables cross-joining `ci_builds` `Security::FindingsFinder`

In !68266 (merged) we've introduced a new cross-DB join query that needs to be removed before we can move ci_* tables to a new database.

Options

See https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-joins-between-ci_-and-non-ci_-tables for different options

Proposal

I can't find an issue linked to !68266 (merged) in order to know why we made this decision. Is this necessary? Can we possibly roll this back so that we can remove the latest_successful_by_build method.

Implementation plan

  • database introduce a new column for the security_scans table called build_status
  • database backfill the data for the new column
  • backend Change the current scope to rely on this new column instead of joining to the ci_builds table
Edited by Mehmet Emin INAC