Skip to content

Swap FK ci_variables.project_id to projects for LFK

What does this MR do and why?

Per &7249 (closed)

As part of our CI "decomposition" efforts we need to remove all foreign keys that are cross-database (ie. between the planned main and ci databases). We are going to replace them all with "loose foreign keys".

Related: #348267 (closed)

Validations

  • Best team to review (check off when reviewed): TBD

  • No way for user to access once parent is deleted. Please explain:

    @furkanayhan : ci_variables are project variables. And they are only accessed via their projects. And, the removal of the variables depends on the FK. They are not being deleted explicitly via project-destroy-service. Do we need to destroy explicitly? Or are we okay to just convert FK to LFK and wait for the LFK delay? I found one thing interesting that we have CiPlatformMetric.insert_auto_devops_platform_targets!. It finds every project variable the key AUTO_DEVOPS_PLATFORM_TARGET and processes something on them. @mbobin : I think it's safe to wait because this processing doesn't try to access the project from the variable and it seems to be executed as a daily task Overall: it looks safe to convert it to LFK

  • Possible to access once parent deleted but low user impact. Please explain:

  • Possible Sidekiq workers that may load directly and possibly lead to exceptions. Please explain:

  • Possible user impact to be evaluated or mitigated. Please explain:

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 Douglas Barbosa Alexandre

Merge request reports