Skip to content

Setup leftover loose foreign key tracked tables

Adam Hegyi requested to merge setup-lfk-for-tracked-tables into master

What does this MR do and why?

Note: the milestone is %14.7, but it can go into %14.6 without any problem.

This change enables the processing of deleted records (loose foreign key) for the leftover parent tables and eliminates the dependent nullify option for the User model.

In the previous MR we started tracking deleted rows for the following tables:

  • users
  • external_pull_requests
  • merge_requests
  • ci_job_artifacts

Our background worker will not process deleted rows related to these tables because they are not configured in our YAML file. This MR adds one loose foreign key entry for each table. The "real" foreign keys are still in place, so the chance for data loss is 0. (there is one exception: users)


Since we're tracking users, we need to set up at least one loose foreign key. I also address this issue: #340260 (closed)

I set up 2 loose foreign keys for the users table and removed the dependent option. These associations did not have foreign keys!

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Adam Hegyi

Merge request reports

Loading