utf8mb4 conversion on database with index adjusts

This commit is contained in:
Mikael Nordfeldth
2015-02-12 18:18:55 +01:00
parent f5bb0431da
commit 2f86cd8602
68 changed files with 285 additions and 278 deletions

View File

@@ -271,7 +271,7 @@ class MysqlSchema extends Schema
function endCreateTable($name, array $def)
{
$engine = $this->preferredEngine($def);
return ") ENGINE=$engine CHARACTER SET utf8 COLLATE utf8_bin";
return ") ENGINE=$engine CHARACTER SET utf8mb4 COLLATE utf8mb4_bin";
}
function preferredEngine($def)
@@ -335,9 +335,10 @@ class MysqlSchema extends Schema
if (strtolower($oldProps['ENGINE']) != strtolower($engine)) {
$phrase[] = "ENGINE=$engine";
}
if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8_bin') {
$phrase[] = 'DEFAULT CHARSET=utf8';
$phrase[] = 'COLLATE=utf8_bin';
if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8mb4_bin') {
$phrase[] = 'CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin';
$phrase[] = 'DEFAULT CHARACTER SET = utf8mb4';
$phrase[] = 'DEFAULT COLLATE = utf8mb4_bin';
}
}