sql: Change charset to `utf8mb4`
fixes https://github.com/Icinga/icingaweb2/issues/4680
This commit is contained in:
parent
1dec3426c9
commit
1b1eb3436f
|
@ -7,6 +7,12 @@ v2.6 to v2.8 requires to follow the instructions for v2.7 too.
|
|||
|
||||
* The Vagrant file and all its assets have been removed.
|
||||
|
||||
**Database Schema**
|
||||
|
||||
* Please apply the `v2.11.0.sql` upgrade script depending on your database vendor.
|
||||
In package installations this file can be found in `/usr/share/doc/icingaweb2/schema/*-upgrades/`
|
||||
(Debian/Ubuntu: `/usr/share/icingaweb2/etc/schema/*-upgrades/`).
|
||||
|
||||
## Upgrading to Icinga Web 2 2.10.x
|
||||
|
||||
**General**
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE `icingaweb_group` CONVERT TO CHARACTER SET utf8mb4;
|
||||
ALTER TABLE `icingaweb_group_membership` CONVERT TO CHARACTER SET utf8mb4;
|
||||
ALTER TABLE `icingaweb_user` CONVERT TO CHARACTER SET utf8mb4;
|
||||
ALTER TABLE `icingaweb_user_preference` CONVERT TO CHARACTER SET utf8mb4;
|
||||
|
||||
ALTER TABLE `icingaweb_group`
|
||||
MODIFY COLUMN `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL;
|
||||
ALTER TABLE `icingaweb_group_membership`
|
||||
MODIFY COLUMN `username` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL;
|
||||
ALTER TABLE `icingaweb_user`
|
||||
MODIFY COLUMN `name` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL;
|
||||
|
||||
ALTER TABLE `icingaweb_user_preference`
|
||||
MODIFY COLUMN `username` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
MODIFY COLUMN `section` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
MODIFY COLUMN `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
CREATE TABLE `icingaweb_group`(
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`parent` int(10) unsigned NULL DEFAULT NULL,
|
||||
`ctime` timestamp NULL DEFAULT NULL,
|
||||
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
@ -10,36 +10,36 @@ CREATE TABLE `icingaweb_group`(
|
|||
UNIQUE KEY `idx_name` (`name`),
|
||||
CONSTRAINT `fk_icingaweb_group_parent_id` FOREIGN KEY (`parent`)
|
||||
REFERENCES `icingaweb_group` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `icingaweb_group_membership`(
|
||||
`group_id` int(10) unsigned NOT NULL,
|
||||
`username` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`username` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`ctime` timestamp NULL DEFAULT NULL,
|
||||
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`group_id`,`username`),
|
||||
CONSTRAINT `fk_icingaweb_group_membership_icingaweb_group` FOREIGN KEY (`group_id`)
|
||||
REFERENCES `icingaweb_group` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `icingaweb_user`(
|
||||
`name` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`active` tinyint(1) NOT NULL,
|
||||
`password_hash` varbinary(255) NOT NULL,
|
||||
`ctime` timestamp NULL DEFAULT NULL,
|
||||
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `icingaweb_user_preference`(
|
||||
`username` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`section` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`username` varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`section` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`value` varchar(255) NOT NULL,
|
||||
`ctime` timestamp NULL DEFAULT NULL,
|
||||
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`username`,`section`,`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `icingaweb_rememberme`(
|
||||
id int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
|
|
@ -21,7 +21,7 @@ class DbUserBackend extends DbRepository implements UserBackendInterface, Inspec
|
|||
*/
|
||||
protected $queryColumns = array(
|
||||
'user' => array(
|
||||
'user' => 'name COLLATE utf8_general_ci',
|
||||
'user' => 'name COLLATE utf8mb4_general_ci',
|
||||
'user_name' => 'name',
|
||||
'is_active' => 'active',
|
||||
'created_at' => 'UNIX_TIMESTAMP(ctime)',
|
||||
|
|
|
@ -225,7 +225,7 @@ class UserBackend implements ConfigAwareFactory
|
|||
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
||||
if ($backendType === 'db' && $resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
$resource = ResourceFactory::createResource($resourceConfig);
|
||||
|
|
|
@ -22,7 +22,7 @@ class DbUserGroupBackend extends DbRepository implements Inspectable, UserGroupB
|
|||
protected $queryColumns = array(
|
||||
'group' => array(
|
||||
'group_id' => 'g.id',
|
||||
'group' => 'g.name COLLATE utf8_general_ci',
|
||||
'group' => 'g.name COLLATE utf8mb4_general_ci',
|
||||
'group_name' => 'g.name',
|
||||
'parent' => 'g.parent',
|
||||
'created_at' => 'UNIX_TIMESTAMP(g.ctime)',
|
||||
|
@ -30,7 +30,7 @@ class DbUserGroupBackend extends DbRepository implements Inspectable, UserGroupB
|
|||
),
|
||||
'group_membership' => array(
|
||||
'group_id' => 'gm.group_id',
|
||||
'user' => 'gm.username COLLATE utf8_general_ci',
|
||||
'user' => 'gm.username COLLATE utf8mb4_general_ci',
|
||||
'user_name' => 'gm.username',
|
||||
'created_at' => 'UNIX_TIMESTAMP(gm.ctime)',
|
||||
'last_modified' => 'UNIX_TIMESTAMP(gm.mtime)'
|
||||
|
|
|
@ -167,7 +167,7 @@ class UserGroupBackend
|
|||
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
||||
if ($backendType === 'db' && $resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
$resource = ResourceFactory::createResource($resourceConfig);
|
||||
|
|
|
@ -132,7 +132,7 @@ abstract class PreferencesStore
|
|||
} elseif ($type === 'Db') {
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||
if ($resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
$config->connection = ResourceFactory::createResource($resourceConfig);
|
||||
|
|
|
@ -38,7 +38,7 @@ class PreferencesCommand extends Command
|
|||
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($resource);
|
||||
if ($resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
$connection = ResourceFactory::createResource($resourceConfig);
|
||||
|
|
|
@ -208,7 +208,7 @@ class UserDomainMigration
|
|||
case 'db':
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($config->get('global', 'config_resource'));
|
||||
if ($resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
/** @var DbConnection $conn */
|
||||
|
@ -295,7 +295,7 @@ class UserDomainMigration
|
|||
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||
if ($resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
/** @var DbConnection $conn */
|
||||
|
@ -348,7 +348,7 @@ class UserDomainMigration
|
|||
|
||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||
if ($resourceConfig->db === 'mysql') {
|
||||
$resourceConfig->charset = 'utf8';
|
||||
$resourceConfig->charset = 'utf8mb4';
|
||||
}
|
||||
|
||||
/** @var DbConnection $conn */
|
||||
|
|
Loading…
Reference in New Issue