Schema: Increase length of username columns

In order to support usernames with domains, the length of the username columns is now 254 which also supports email addresses as usernames.

refs #2153
This commit is contained in:
Eric Lippmann 2017-06-07 15:52:41 +02:00 committed by Alexander A. Klimov
parent 53eae8d93e
commit 755b2108a8
4 changed files with 16 additions and 6 deletions

View File

@ -0,0 +1,5 @@
# Icinga Web 2 | (c) 2017 Icinga Development Team | GPLv2+
ALTER TABLE `icingaweb_group_membership` MODIFY COLUMN `username` varchar(254) COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `icingaweb_user` MODIFY COLUMN `name` varchar(254) COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `icingaweb_user_preference` MODIFY COLUMN `username` varchar(254) COLLATE utf8_unicode_ci NOT NULL;

View File

@ -14,7 +14,7 @@ CREATE TABLE `icingaweb_group`(
CREATE TABLE `icingaweb_group_membership`( CREATE TABLE `icingaweb_group_membership`(
`group_id` int(10) unsigned NOT NULL, `group_id` int(10) unsigned NOT NULL,
`username` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `username` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
`ctime` timestamp NULL DEFAULT NULL, `ctime` timestamp NULL DEFAULT NULL,
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`group_id`,`username`), PRIMARY KEY (`group_id`,`username`),
@ -23,7 +23,7 @@ CREATE TABLE `icingaweb_group_membership`(
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `icingaweb_user`( CREATE TABLE `icingaweb_user`(
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL, `active` tinyint(1) NOT NULL,
`password_hash` varbinary(255) NOT NULL, `password_hash` varbinary(255) NOT NULL,
`ctime` timestamp NULL DEFAULT NULL, `ctime` timestamp NULL DEFAULT NULL,
@ -32,7 +32,7 @@ CREATE TABLE `icingaweb_user`(
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `icingaweb_user_preference`( CREATE TABLE `icingaweb_user_preference`(
`username` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `username` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
`section` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `section` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(255) NOT NULL, `value` varchar(255) NOT NULL,

View File

@ -0,0 +1,5 @@
/* Icinga Web 2 | (c) 2017 Icinga Development Team | GPLv2+ */
ALTER TABLE "icingaweb_group_membership" ALTER COLUMN "username" TYPE character varying(254);
ALTER TABLE "icingaweb_user" ALTER COLUMN "name" TYPE character varying(254);
ALTER TABLE "icingaweb_user_preference" ALTER COLUMN "username" TYPE character varying(254);

View File

@ -35,7 +35,7 @@ ALTER TABLE ONLY "icingaweb_group"
CREATE TABLE "icingaweb_group_membership" ( CREATE TABLE "icingaweb_group_membership" (
"group_id" int NOT NULL, "group_id" int NOT NULL,
"username" character varying(64) NOT NULL, "username" character varying(254) NOT NULL,
"ctime" timestamp NULL DEFAULT NULL, "ctime" timestamp NULL DEFAULT NULL,
"mtime" timestamp NULL DEFAULT NULL "mtime" timestamp NULL DEFAULT NULL
); );
@ -57,7 +57,7 @@ CREATE UNIQUE INDEX idx_icingaweb_group_membership
); );
CREATE TABLE "icingaweb_user" ( CREATE TABLE "icingaweb_user" (
"name" character varying(64) NOT NULL, "name" character varying(254) NOT NULL,
"active" smallint NOT NULL, "active" smallint NOT NULL,
"password_hash" bytea NOT NULL, "password_hash" bytea NOT NULL,
"ctime" timestamp NULL DEFAULT NULL, "ctime" timestamp NULL DEFAULT NULL,
@ -77,7 +77,7 @@ CREATE UNIQUE INDEX idx_icingaweb_user
); );
CREATE TABLE "icingaweb_user_preference" ( CREATE TABLE "icingaweb_user_preference" (
"username" character varying(64) NOT NULL, "username" character varying(254) NOT NULL,
"name" character varying(64) NOT NULL, "name" character varying(64) NOT NULL,
"section" character varying(64) NOT NULL, "section" character varying(64) NOT NULL,
"value" character varying(255) NOT NULL, "value" character varying(255) NOT NULL,