-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Can't create a not nullable generated column in mysql #31398
Comments
@DrCake adding nullable() to any migration column makes its nullable. Remove nullable(false) from your location row. |
The fix was for MariaDB that (still) doesn't support It's not trivial to have different implementations for MySQL and MariaDB without database/version-specific grammars (laravel/ideas#870). |
@BenQoder Adding false as the parameter to nullabe() is a manual way of specifying not null. I added it just to check that the default for staredAs isn't 'null' instaed of the normal 'not null'. |
Is it possible to keep it nullable by default unless |
It would be possible, but it's definitely not an elegant solution. |
As this is rather a change in behavior than a bug fix feel free to discuss this further on the ideas repo. |
@staudenmeir @DrCake Thanks for advising and submitting PR! |
Description:
When creating a generated column in my migration, the
nullable()
modifier method has no effect on the column that is created. It looks like this was disabled to fix an issue back in 5.3 but hasn't been re-enabled now that MySQL supports it.Steps To Reproduce:
The Migration
Running this migration, if you inspect the database you will see that the
location
column is nullable. So if you try and add a spatial index on thelocation
column, you will get an error that you can't create the index on a column that is allowed to be nullThe text was updated successfully, but these errors were encountered: