pick whether virtual columns are persistent or virtual based on primary

This commit is contained in:
Joby Elliott 2018-09-25 11:07:14 -06:00
parent 29559fb18f
commit 8677ce5857

View file

@ -52,7 +52,13 @@ class MySQLDriver extends AbstractDriver
$lines = [];
$lines[] = "`json_data` JSON DEFAULT NULL";
foreach ($args['virtualColumns'] as $path => $col) {
$lines[] = "`{$col['name']}` {$col['type']} GENERATED ALWAYS AS (".$this->expandPath($path).") VIRTUAL";
$line = "`{$col['name']}` {$col['type']} GENERATED ALWAYS AS (".$this->expandPath($path).")";
if (@$col['primary']) {
$line .= ' PERSISTENT';
} else {
$line .= ' VIRTUAL';
}
$lines[] = $line;
}
foreach ($args['virtualColumns'] as $path => $col) {
if (@$col['primary']) {