X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fmysqlschema.php;h=f1fc0f46ecd5c600fa12c4d4e128387288718ac1;hb=c4f60ab444ab4768d12c5a4e6de010b185da7528;hp=c3d3501c74cff52f6018cc73ac8120be65970a75;hpb=e109b2592f86dec977922bc4474dde36aed109cb;p=quix0rs-gnu-social.git diff --git a/lib/mysqlschema.php b/lib/mysqlschema.php index c3d3501c74..f1fc0f46ec 100644 --- a/lib/mysqlschema.php +++ b/lib/mysqlschema.php @@ -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) @@ -298,6 +298,16 @@ class MysqlSchema extends Schema return "{$tableName}_{$columnName}_idx"; } + /** + * MySQL doesn't take 'DROP CONSTRAINT', need to treat primary keys as + * if they were indexes here, but can use 'PRIMARY KEY' special name. + * + * @param array $phrase + */ + function appendAlterDropPrimary(array &$phrase) + { + $phrase[] = 'DROP PRIMARY KEY'; + } /** * MySQL doesn't take 'DROP CONSTRAINT', need to treat unique keys as @@ -325,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'; } }