-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schema: Change character set to utf8mb4 (support for Emojis in Menus/…
…Pages/News/Forum etc.)
- Loading branch information
Showing
3 changed files
with
56 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
} | ||
} | ||
}; |