mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-13 17:24:54 +02:00
schema: Change character set to utf8mb4 (support for Emojis in Menus/Pages/News/Forum etc.)
This commit is contained in:
35
system/migrations/41.php
Normal file
35
system/migrations/41.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Change database tables character set to utf8mb4
|
||||
* Previously it was utf8 (utf8mb3)
|
||||
* utf8 will become utf8mb4 in future releases of mysql
|
||||
*/
|
||||
$tables = [
|
||||
'account_actions', 'admin_menu',
|
||||
'changelog', 'config',
|
||||
'faq', 'forum_boards', 'forum',
|
||||
'gallery',
|
||||
'menu', 'monsters',
|
||||
'news', 'news_categories', 'notepad',
|
||||
'pages',
|
||||
'settings', 'spells',
|
||||
'visitors', 'weapons',
|
||||
];
|
||||
|
||||
$up = function () use ($db, $tables)
|
||||
{
|
||||
foreach ($tables as $table) {
|
||||
if ($db->hasTable(TABLE_PREFIX . $table)) {
|
||||
$db->exec('ALTER TABLE ' . TABLE_PREFIX . $table . ' CONVERT TO CHARACTER SET utf8mb4');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$down = function () use ($db, $tables)
|
||||
{
|
||||
foreach ($tables as $table) {
|
||||
if ($db->hasTable(TABLE_PREFIX . $table)) {
|
||||
$db->exec('ALTER TABLE ' . TABLE_PREFIX . $table . ' CONVERT TO CHARACTER SET utf8');
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user