Sec DB Decomposition Slice 3 - Vulnerability Featureset
## What As the third slice of [the Sec DB decomposition effort](https://gitlab.com/groups/gitlab-org/-/epics/13043 "Decompose Secure and Govern related tables to a separate Postgres DB") we will target the `vulnerability_*` and `vulnerabilities` featureset. As of 2024-06-12: | Table | Foreign Keys | Amount of References to Model (approximate) | Notes/Questions | |-------|--------------|---------------------------------------------|-----------------| | vulnerabilities | (project_id, author_id, resolved_by_id, confirmed_by_id, dismissed_by_id, finding_id) | 232 uses across | 108 files | | vulnerability_exports | (organization_id, project_id, author_id, group_id, file_store) | 15 uses across 6 files | Exports have a file associated with them using a file_store field. We will likely not be able to get a duplicated record in a separate database to refer to the same on disk file as the original record, which means until the transition is complete we will need to double store files. | | vulnerability_export_parts | (organization_id, vulnerability_export_id) | | | | vulnerability_external_issue_links | (author_id, vulnerability_id) | 6 uses across 4 files | | | vulnerability_feedback | (project_id, author_id, issue_id, merge_request_id, comment_author_id) | 25 matches across 12 files | Deprecated model, seeking to be deleted. May be able to avoid transitioning. https://gitlab.com/groups/gitlab-org/-/epics/9552 | | vulnerability_finding_evidences | (project_id, vulnerability_occurrence_id) | 3 uses across 3 files | | | vulnerability_finding_links | (vulnerability_occurrence_id) | 3 uses across 3 files | | | vulnerability_finding_signatures | (project_id, finding_id) | 6 uses across 6 files | | | vulnerability_findings_remediations | (project_id, vulnerability_occurrence_id, vulnerability_remediation_id) | 1 match across 1 file | | | vulnerability_flags | (project_id, vulnerability_occurrence_id) | 4 matches across 4 files | | | vulnerability_historical_statistics | (project_id) | 9 matches across 5 files | | | vulnerability_identifiers | (project_id) | 8 matches across 7 files | | | vulnerability_issue_links | (project_id, vulnerability_id, issue_id) | 37 matches across 17 files | | | vulnerability_merge_request_links | (project_id, vulnerability_id, merge_request_id) | 25 matches across 16 files | | | vulnerability_occurrence_identifiers | (occurrence_id, identifier_id) | 10 matches across 9 files | | | vulnerability_occurrence_pipelines | (occurrence_id) | 11 matches across 10 files | Table is due to be deleted. | | vulnerability_occurrences | (project_id, scanner_id, primary_identifier_id, vulnerability_id) | 54 matches across 22 files | | | vulnerability_reads | (vulnerability_id, project_id, scanner_id, namespace_id, casted_cluster_agent_id) | 35 matches across 12 files | | | vulnerability_remediations | project_id, file_store | 24 matches across 16 files | Remediations have a file associated with them using a file_store field. We will likely not be able to get a duplicated record in a separate database to refer to the same on disk file as the original record, which means until the transition is complete we will need to double store files. | | vulnerability_scanners | (project_id) | 52 matches across 43 files | | | vulnerability_state_transitions | (project_id, vulnerability_id, author_id) | 55 matches across 33 files | | | vulnerability_statistics | (project_id, latest_pipeline_id) | 61 matches across 28 files | | | vulnerability_user_mentions | (project_id, vulnerability_id, mentioned_users_ids, mentioned_projects_ids, mentioned_groups_ids) | 15 matches across 15 files | | | vulnerability_namespace_historical_statistics | (namespace_id) | | Will be added in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/162577 |
epic