summaryrefslogtreecommitdiffstats
path: root/application/migrations/021_change_charset.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-12-02 16:26:15 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-12-02 16:26:55 +0100
commit774f1cc3c97957095f34ee5fa653aed802533138 (patch)
tree641cb0c377bd4a378a27fab2fa68eae7268d4b04 /application/migrations/021_change_charset.php
parent1c1aa79a516d5566c32216ddbb9530fbe26f20e6 (diff)
Migration 21: Limit utf8mb4 to columns that need it
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/migrations/021_change_charset.php')
-rw-r--r--application/migrations/021_change_charset.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/application/migrations/021_change_charset.php b/application/migrations/021_change_charset.php
index 20a8ce7f7..475732ed5 100644
--- a/application/migrations/021_change_charset.php
+++ b/application/migrations/021_change_charset.php
@@ -11,10 +11,11 @@ class Migration_change_charset extends CI_Migration {
# nothing to do
} else {
$this->db->query('SET FOREIGN_KEY_CHECKS = 0');
- foreach (['actions', 'apikeys', 'files', 'file_storage', 'multipaste', 'multipaste_file_map', 'profiles', 'users'] as $table) {
- $this->db->query('
- ALTER TABLE `'.$prefix.$table.'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
- ');
+ foreach ([
+ ['apikeys', 'comment', 'VARCHAR(255)'],
+ ['files', 'filename', 'VARCHAR(256)'],
+ ] as $col) {
+ $this->db->query('ALTER TABLE `'.$prefix.$col[0].'` CHANGE `'.$col[1].'` `'.$col[1].'` '.$col[2].' CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;');
}
$this->db->query('SET FOREIGN_KEY_CHECKS = 1');
}