From a9494245897dbef61abcceec7da4a43ee5ecc5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=BCmel?= Date: Sat, 4 Sep 2021 15:10:51 +0200 Subject: [PATCH] Swith to utf8mb4 on mysql Fix: #197 --- resources/lib/storeMySql.py | 3 ++- resources/lib/storeMySqlSetup.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/lib/storeMySql.py b/resources/lib/storeMySql.py index 8e24146..9138b9a 100644 --- a/resources/lib/storeMySql.py +++ b/resources/lib/storeMySql.py @@ -43,7 +43,8 @@ def getConnection(self): 'user': self.settings.getDatabaseUser(), 'password': self.settings.getDatabasePassword(), 'connect_timeout':24 * 60 * 60, - 'charset':'utf8', + 'charset':'utf8mb4', + 'collation':'utf8mb4_general_ci', 'use_unicode':True } diff --git a/resources/lib/storeMySqlSetup.py b/resources/lib/storeMySqlSetup.py index 795fdf4..5fc4034 100644 --- a/resources/lib/storeMySqlSetup.py +++ b/resources/lib/storeMySqlSetup.py @@ -16,7 +16,7 @@ def __init__(self, dbCon): self.logger = appContext.MVLOGGER.get_new_logger('StoreMySQLSetup') self.settings = appContext.MVSETTINGS self.conn = dbCon - self._setupSchema = 'CREATE DATABASE IF NOT EXISTS `{}` DEFAULT CHARACTER SET utf8;'.format(self.settings.getDatabaseSchema()) + self._setupSchema = 'CREATE DATABASE IF NOT EXISTS `{}` DEFAULT CHARACTER SET utf8mb4;'.format(self.settings.getDatabaseSchema()) self._setupScript = """ -- ---------------------------- -- DB V2 @@ -47,7 +47,7 @@ def __init__(self, dbCon): url_video varchar(384) NULL, url_video_sd varchar(384) NULL, url_video_hd varchar(384) NULL -) ENGINE=InnoDB CHARSET=utf8; +) ENGINE=InnoDB CHARSET=utf8mb4; -- CREATE INDEX idx_idhash ON film (idhash); -- ---------------------------- @@ -55,7 +55,7 @@ def __init__(self, dbCon): -- ---------------------------- DROP TABLE IF EXISTS status; CREATE TABLE status ( - status varchar(255) NOT NULL, + status varchar(191) NOT NULL, lastupdate int(11) NOT NULL, lastFullUpdate int(11) NOT NULL, filmupdate int(11) NOT NULL,