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

[5.3] Fix storedAs virtualAs #16683

Merged
merged 1 commit into from
Dec 7, 2016
Merged

[5.3] Fix storedAs virtualAs #16683

merged 1 commit into from
Dec 7, 2016

Conversation

fernandobandeira
Copy link
Contributor

Fixes #16643

Currently the Grammar is appending not null and null when generating the virtualAs and storedAs columns.

This is an invalid syntax since these are generated columns so you can't use that, currently it's throwing:

Syntax error or access violation: 1064 You have an error in your SQL syntax

Example of current sql:

alter table `products` add `price` int not null, add `discounted_virtual` int as (price - 5) not null, add `discounted_stored` int as (price - 5) not null stored

after this fix

alter table `products` add `price` int not null, add `discounted_virtual` int as (price - 5), add `discounted_stored` int as (price - 5) stored

@chuck-wood
Copy link

It would be nice to mention this in the documentation. It's just lucky that I happened to notice that my generated columns were lacking their constraints before deploying to production! I am running MySQL, which does support this feature.

I'm on Laravel 5.5, not sure if this has changed in later versions. Thanks!

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.

None yet

3 participants