Backfill target_project_id for ComplianceViolation
What does this MR do and why?
Creates a batched background migration to backfill target_project_id
if it is null for the merge_requests_compliance_violations
table.
It resorts to using the foreign key, merge_requests.target_project_id
value
After this is merged there will be two follow-up additions:
- Add this to the ComplianceViolation model:
belongs_to :target_project, class_name: 'Project', optional: false
- Add a new migration to make
target_project_id
NOT NULL so we can use it as a sharding key.
References
MR acceptance checklist
- Plan on UPDATE: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/33620/commands/103444
Screenshots or screen recordings
Edited by Andrew Jung