-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
morph key column type should not be fixed to unsigned big integer #23935
Comments
@tillkruss why has this been closed? I think |
This was probably closed because it's a feature request, not a bug report. This repo is for bug reports. Use laravel/ideas for feature requests. |
Changing the column types in a patch release (it was done in v5.6.5 -> v5.6.6) is a BC-breaking change, i.e. a regression. Users might have foreign keys for that columns... And now my local system with a fresh database has other column types than the production environment, where the migrations have run with the old version. |
This issue was about migrating to 5.6, where some BC breaks are expected. If the issue was from 5.6.5 to 5.6.6, I suggest you open a new issue where the title makes it clear that it's a bug report instead of sounding like a suggestion, and reference the pull request where this was changed. Mind you, it would probably be too late to change this back on 5.6 since there have probable been a lot more 5.6 projects started after 5.6.6 than before, and changing it back would be a BC break for all of those. |
Description:
Just migrated to Laravel 5.6, and found that morph methods in
Schema\Blueprint
have been changed to use unsigned big integer:morphs()
&nullableMorphs
by commit.This change breaks a lot! And I don't think it could be easy or reasonable to change existing system for this. If this change has to be kept, it should provide a parameter to determine the type of column to be used.
To my case, the related columns of the morph targets are all auto increment unsigned integer primary key columns. I don't want to bring the
INT
vsBIGINT
auto increment
primary key argument here. The short answer is we can't change those primary keys toBIGINT
.My current work around is changing our migrations to alter the column type right after the
Schema::create()
call, and adds foreign key afterward.The text was updated successfully, but these errors were encountered: