-
प्रथमेश Sonpatki authored
* Respect options passed to `foreign_key` when reverting `add_reference` The code incorrectly assumes that the option was written as `foreign_key: true`, but that is not always the case. This now mirrors the behavior of reverting `add_foreign_key`. The code was changed to use kwargs while I was touching it, as well. This could really use a refactoring to go through the same code paths as `add_refernce` in the future, so we don't duplicate default values. Fixes #25169 * Backport part of https://github.com/rails/rails/commit/1b8a7b8293e0ff944eb9a5ed84a17b51a87be696 - For fixing tests caused by d18fd490316cd2299c87167ba44de15e79322bb4 - Fixes #25755 * From original commit message - Additionally, there was a bug in `remove_foreign_key` if you passed it an options hash containing `to_table`. This now occurs whenever removing a reference, as we always normalize to a hash. - The original commit can't be cherry-picked as it contains other fixes too which are not applicable for 5-0-stable.
प्रथमेश Sonpatki authored* Respect options passed to `foreign_key` when reverting `add_reference` The code incorrectly assumes that the option was written as `foreign_key: true`, but that is not always the case. This now mirrors the behavior of reverting `add_foreign_key`. The code was changed to use kwargs while I was touching it, as well. This could really use a refactoring to go through the same code paths as `add_refernce` in the future, so we don't duplicate default values. Fixes #25169 * Backport part of https://github.com/rails/rails/commit/1b8a7b8293e0ff944eb9a5ed84a17b51a87be696 - For fixing tests caused by d18fd490316cd2299c87167ba44de15e79322bb4 - Fixes #25755 * From original commit message - Additionally, there was a bug in `remove_foreign_key` if you passed it an options hash containing `to_table`. This now occurs whenever removing a reference, as we always normalize to a hash. - The original commit can't be cherry-picked as it contains other fixes too which are not applicable for 5-0-stable.
Loading