From 774f1cc3c97957095f34ee5fa653aed802533138 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 2 Dec 2017 16:26:15 +0100 Subject: Migration 21: Limit utf8mb4 to columns that need it Signed-off-by: Florian Pritz --- application/migrations/021_change_charset.php | 9 +++++---- 1 file 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'); } -- cgit v1.2.3-24-g4f1b