Add migration to make some foreign key names consistent
What does this MR do and why?
The database diagnostics page identified a number of missing foreign keys, but they actually exist in other names. It appears that these inconsistencies occurred for a number of reasons:
-
ActiveRecord automatically generates foreign keys in the form of
fk_rails_<hash>, but during the squashing of migrations these foreign keys got renamed tofk_<hash>. This commit adds a migration to rename known foreign keys back tofk_rails_<hash>again. -
Some indexes were not renamed when their respective tables were renamed.
<hash>is calculated with the original table name. This commit adds a migration to rename the foreign keys using the hash with the new table name.
References
https://gitlab.com/gitlab-com/request-for-help/-/issues/3342
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.