From 37bb24d5ee88e6719f2470ef2401930870c40a2e Mon Sep 17 00:00:00 2001 From: Mitchell Hewes Date: Tue, 24 Jan 2017 08:25:59 +1100 Subject: [PATCH] New version of mysql schema to support utf8mb4 on title, author, and content --- app/core/database.php | 2 +- app/schemas/mysql.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/core/database.php b/app/core/database.php index addfc59..c1d77e8 100644 --- a/app/core/database.php +++ b/app/core/database.php @@ -47,7 +47,7 @@ function get_connection_parameters() 'password' => DB_PASSWORD, 'database' => DB_NAME, 'port' => DB_PORT, - 'charset' => 'utf8', + 'charset' => 'utf8mb4', ); } else { require_once __DIR__.'/../schemas/sqlite.php'; diff --git a/app/schemas/mysql.php b/app/schemas/mysql.php index a7d44ed..a7c9090 100644 --- a/app/schemas/mysql.php +++ b/app/schemas/mysql.php @@ -5,7 +5,14 @@ namespace Miniflux\Schema; use PDO; use Miniflux\Helper; -const VERSION = 1; +const VERSION = 2; + +function version_2(PDO $pdo) +{ + $pdo->exec('ALTER TABLE items CHANGE title title TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL'); + $pdo->exec('ALTER TABLE items CHANGE author author TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'); + $pdo->exec('ALTER TABLE items CHANGE content content LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'); +} function version_1(PDO $pdo) {