Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[5.2] Add "Generated Columns" support to MySQL schema grammar#13430

Merged
taylorotwell merged 1 commit into
laravel:5.2from
themsaid:mysql-generated-columns
May 6, 2016
Merged

[5.2] Add "Generated Columns" support to MySQL schema grammar#13430
taylorotwell merged 1 commit into
laravel:5.2from
themsaid:mysql-generated-columns

Conversation

@themsaid
Copy link
Copy Markdown
Member

@themsaid themsaid commented May 4, 2016

$table->discounted_price->virtualAs('price - 5');

$table->discounted_price->storedAs('price - 5');

This generates Virtual and Stored generated columns introduced in MySQL 5.7.6.

For Reference:
http://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html

* Get the SQL for a generated virtual column modifier.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @param \Illuminate\Support\Fluent $column
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be string|void

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void cannot be unioned with anything

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on that ? References ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

laravel considers void to mean garbage, not "no return"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is possible that definition is changing in php 7.1, but for now, we're sticking with our original definition

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.

4 participants