Skip to content

Commit

Permalink
Fix MySQL Schema Grammar $modifiers order
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
mpyw committed Jul 23, 2019
1 parent dadda56 commit 282c677
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MySqlGrammar extends Grammar
* @var array
*/
protected $modifiers = [
'Unsigned', 'VirtualAs', 'StoredAs', 'Charset', 'Collate', 'Nullable',
'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
];

Expand Down

0 comments on commit 282c677

Please sign in to comment.