mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-27 03:12:21 -05:00
Merge pull request #843 from rros/mysql-utf8mb4
Convert the MySQL charset to utf8mb4 to support the full range of unicode
This commit is contained in:
commit
5b16d508b5
@ -31,8 +31,10 @@ class Database {
|
|||||||
$this->handle = new PDO($db_path);
|
$this->handle = new PDO($db_path);
|
||||||
break;
|
break;
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
|
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB . ';charset=utf8mb4';
|
||||||
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD);
|
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD, array(
|
||||||
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
case 'postgres':
|
case 'postgres':
|
||||||
$db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
|
$db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS `config` (
|
|||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`value` varchar(255) NOT NULL,
|
`value` varchar(255) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `entries` (
|
CREATE TABLE IF NOT EXISTS `entries` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `entries` (
|
|||||||
`content` blob NOT NULL,
|
`content` blob NOT NULL,
|
||||||
`user_id` int(11) NOT NULL,
|
`user_id` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `users` (
|
CREATE TABLE IF NOT EXISTS `users` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS `users` (
|
|||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`email` varchar(255) NOT NULL,
|
`email` varchar(255) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `users_config` (
|
CREATE TABLE IF NOT EXISTS `users_config` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
@ -31,13 +31,13 @@ CREATE TABLE IF NOT EXISTS `users_config` (
|
|||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`value` varchar(255) NOT NULL,
|
`value` varchar(255) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tags` (
|
CREATE TABLE IF NOT EXISTS `tags` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`value` varchar(255) NOT NULL,
|
`value` varchar(255) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tags_entries` (
|
CREATE TABLE IF NOT EXISTS `tags_entries` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
@ -46,4 +46,4 @@ CREATE TABLE IF NOT EXISTS `tags_entries` (
|
|||||||
FOREIGN KEY(entry_id) REFERENCES entries(id) ON DELETE CASCADE,
|
FOREIGN KEY(entry_id) REFERENCES entries(id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE,
|
FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
Loading…
Reference in New Issue
Block a user