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.8] Fix MySQL Schema Grammar $modifiers order #29265

Merged
merged 2 commits into from
Jul 23, 2019
Merged

[5.8] Fix MySQL Schema Grammar $modifiers order #29265

merged 2 commits into from
Jul 23, 2019

Conversation

mpyw
Copy link
Contributor

@mpyw mpyw commented Jul 23, 2019

Charset/Collate must be placed before VirtualAs/StoredAs.

e.g.

$table->string('hash', 64)->charset('ascii')->storedAs('sha2(url, 256)')

According to Sequel Pro, this is equivalent to:

`hash` varchar(64) CHARACTER SET ascii GENERATED ALWAYS AS (sha2(`url`,256)) STORED

Currently, however, this is compiled as (Syntax Error):

`hash` varchar(64) as (sha2(url, 256)) stored character set ascii

@mpyw mpyw changed the title Fix MySQL Schema Grammar $modifiers order [5.8] Fix MySQL Schema Grammar $modifiers order Jul 23, 2019
mpyw added 2 commits July 23, 2019 14:47
Charset/Collate must be placed before VirtualAs/StoredAs.

e.g.

```php
$table->string('hash', 64)->charset('ascii')->storedAs('sha2(`url`,256)')
```

According to Sequel Pro, this is equivalent to:

```sql
`hash` varchar(64) CHARACTER SET ascii GENERATED ALWAYS AS (sha2(`url`,256)) STORED
```
@taylorotwell taylorotwell merged commit b41c04a into laravel:5.8 Jul 23, 2019
@mpyw mpyw deleted the fix-mysql-schema-grammar-modifiers-order branch July 24, 2019 05:11
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.

3 participants