Skip to content

Fix LFK foreign key definition

Adam Hegyi requested to merge fix-lfk-from-table-to-table-definition into master

What does this MR do and why?

We use the ActiveRecord::ConnectionAdapters::ForeignKeyDefinition class to represent loose foreign keys. Unfortunately, we mapped the tables incorrectly. to_table - from_table must be swapped.

This MR makes the swap, updates the docs and updates the schema tests. It's safe to deploy in a multi-version environment.

In the schema tests, we verify if the columns ending with _id has FK definition. We're planning to remove some foreign keys and replace them with LFK so the tests are updated to also take the configured LFKs into account.

MR acceptance checklist

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

Merge request reports