Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dropForeignIdFor method complementary to foreignIdFor #54102

Conversation

willrowe
Copy link
Contributor

@willrowe willrowe commented Jan 7, 2025

The dropForeignIdFor method was originally introduced in #40950. As stated in that PR, it was intended to be the counterpart to the foreignIdFor method. However, the actual implementation attempts to drop a foreign key, which foreignIdFor does not add by default. It also does not drop the column that foreignIdFor adds by default.

This issue was reported in #43753 and a fix was attempted in #45134, but it did not pass tests.

I am not sure if this should be considered a true bug fix since it could potentially be a breaking change, so I have targeted master.

This PR changes dropForeignIdFor to only drop the column instead of only dropping the foreign key. The existing dropConstrainedForeignIdFor method should be used to drop both the foreign key and column. The tests have been updated accordingly.

@taylorotwell taylorotwell merged commit 941c439 into laravel:master Jan 7, 2025
29 checks passed
@willrowe willrowe deleted the feature/make-drop-foreign-key-for-complementary branch January 8, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants