Skip to content

Add loose foreign key for ci_job_token_project_scope_links.add_by_id

What does this MR do and why?

Per #348268 (closed) we need to remove this foreign key and replace it with a "loose foreign key" https://docs.gitlab.com/ee/development/database/loose_foreign_keys.html .

It is safest to first add the LFK (as in this MR) and then remove the foreign key in a later MR. In the meantime the LFK will have nothing to cleanup as the foreign key is still cleaning up everything on delete.

Loose foreign keys are cleaned up async so we need to be sure it is safe to remove the foreign key first.

According to #348268 (closed) this is safe because:

No way for user to access once parent is deleted. Please explain: The added_by is used only for tracking purpose and it's not currently displayed

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #348268 (closed)

Merge request reports