Bug fixes for utf8mb4

This commit is contained in:
Taras Machyshyn
2018-10-12 15:39:09 +03:00
parent bf503db267
commit 29f3f7c330
2 changed files with 11 additions and 4 deletions
@@ -379,14 +379,14 @@ class MySqlPlatform extends \Doctrine\DBAL\Platforms\MySqlPlatform
// Charset
if ( ! isset($options['charset'])) {
$options['charset'] = 'utf8';
$options['charset'] = 'utf8mb4';
}
$tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']);
// Collate
if ( ! isset($options['collate'])) {
$options['collate'] = 'utf8_unicode_ci';
$options['collate'] = 'utf8mb4_unicode_ci';
}
$tableOptions[] = sprintf('COLLATE %s', $options['collate']);
@@ -465,4 +465,4 @@ class MySqlPlatform extends \Doctrine\DBAL\Platforms\MySqlPlatform
return implode(', ', $queryFields);
}
//end: ESPO
}
}
@@ -373,6 +373,13 @@ class Converter
}
}
$databaseParams = $this->getConfig()->get('database');
if (!isset($databaseParams['charset']) || $databaseParams['charset'] == 'utf8mb4') {
$dbFieldParams['platformOptions'] = array(
'collation' => 'utf8mb4_unicode_ci',
);
}
switch ($fieldParams['type']) {
case 'id':
case 'foreignId':
@@ -515,4 +522,4 @@ class Converter
return $tables;
}
}
}