From b123afe5943b6b6798ae492c9cb0554046c1f9b5 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 29 May 2015 08:54:32 +0200 Subject: [PATCH] mysql schema: Make parent column a foreign key as well refs #8826 --- etc/schema/mysql.schema.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/schema/mysql.schema.sql b/etc/schema/mysql.schema.sql index bbc801d8b..5f22aead3 100644 --- a/etc/schema/mysql.schema.sql +++ b/etc/schema/mysql.schema.sql @@ -3,11 +3,13 @@ CREATE TABLE `icingaweb_group`( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `parent` varchar(64) COLLATE utf8_unicode_ci NULL DEFAULT NULL, + `parent` int(10) unsigned NULL DEFAULT NULL, `ctime` timestamp NULL DEFAULT NULL, `mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), - UNIQUE KEY `idx_name` (`name`) + UNIQUE KEY `idx_name` (`name`), + CONSTRAINT `fk_icingaweb_group_parent_id` FOREIGN KEY (`parent`) + REFERENCES `icingaweb_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `icingaweb_group_membership`(