From 99bf28fef1a5bb0f89919d1e5e722c9eace6826a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 28 Oct 2017 20:36:59 +0200 Subject: mysql: Enable full UTF8 support Signed-off-by: Florian Pritz --- application/migrations/021_change_charset.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 application/migrations/021_change_charset.php (limited to 'application/migrations') diff --git a/application/migrations/021_change_charset.php b/application/migrations/021_change_charset.php new file mode 100644 index 000000000..20a8ce7f7 --- /dev/null +++ b/application/migrations/021_change_charset.php @@ -0,0 +1,27 @@ +db->dbprefix; + + if ($this->db->dbdriver == 'postgre') { + # 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; + '); + } + $this->db->query('SET FOREIGN_KEY_CHECKS = 1'); + } + } + + public function down() + { + throw new \exceptions\ApiException("migration/downgrade-not-supported", "downgrade not supported"); + } +} -- cgit v1.2.3-24-g4f1b