Draft: Drop foreign key constraint
What does this MR do and why?
The merge request updates the database schema and configuration to remove a foreign key constraint between the subscription_add_on_purchases
and subscription_add_ons
tables. This change allows for more flexibility in managing subscription add-on purchases and ensures data integrity. Additionally, it addresses potential issues related to cross-database foreign keys and improves overall database performance.
Related MR: Draft: Add loose foreign keys (!153731 - closed)
Lose foreign keys
Regarding the gitlab_subscription_add_on
, currently, we do find_or_create_by
for any new add_on
added to table.
There is not any code in application logic to delete the table, so in theory the record should never be deleted, once created, from the application. Also, it makes sense as we would have to support any add_on that we have sold to customers.
In future, if the need arises to delete any record for gitlab_subscription_add_on
, we will probably do it via migration/rake task and we need to take care of associated add_on_purchase
records deletion.
In conclusion, this should not affect the existing code base and application logic.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Related to #444666