Ticket #263: Connections and groups should be unique only within the parent group.

This commit is contained in:
James Muehlner
2013-07-31 21:43:51 -07:00
parent c765a699c2
commit 6747c51b38
2 changed files with 14 additions and 11 deletions

View File

@@ -6,16 +6,16 @@
CREATE TABLE `guacamole_connection_group` (
`connection_group_id` int(11) NOT NULL AUTO_INCREMENT,
`parent_group_id` int(11),
`parent_id` int(11),
`connection_group_name` varchar(128) NOT NULL,
`type` enum('ORGANIZATIONAL',
'BALANCING') NOT NULL DEFAULT 'ORGANIZATIONAL',
PRIMARY KEY (`connection_group_id`),
UNIQUE KEY `connection_group_name` (`connection_group_name`),
UNIQUE KEY `connection_group_name_parent` (`connection_group_name`, `parent_id`),
CONSTRAINT `guacamole_connection_group_ibfk_1`
FOREIGN KEY (`parent_group_id`)
FOREIGN KEY (`parent_id`)
REFERENCES `guacamole_connection_group` (`connection_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -30,14 +30,14 @@ CREATE TABLE `guacamole_connection` (
`connection_id` int(11) NOT NULL AUTO_INCREMENT,
`connection_name` varchar(128) NOT NULL,
`connection_group_id` int(11),
`parent_id` int(11),
`protocol` varchar(32) NOT NULL,
PRIMARY KEY (`connection_id`),
UNIQUE KEY `connection_name` (`connection_name`),
UNIQUE KEY `connection_name_parent` (`connection_name`, `parent_id`),
CONSTRAINT `guacamole_connection_ibfk_1`
FOREIGN KEY (`connection_group_id`)
FOREIGN KEY (`parent_id`)
REFERENCES `guacamole_connection_group` (`connection_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@@ -6,17 +6,17 @@
CREATE TABLE `guacamole_connection_group` (
`connection_group_id` int(11) NOT NULL AUTO_INCREMENT,
`parent_group_id` int(11),
`parent_id` int(11),
`connection_group_name` varchar(128) NOT NULL,
`type` enum('ORGANIZATIONAL',
'BALANCING') NOT NULL DEFAULT 'ORGANIZATIONAL',
PRIMARY KEY (`connection_group_id`),
UNIQUE KEY `connection_group_name` (`connection_group_name`),
UNIQUE KEY `connection_group_name_parent` (`connection_group_name`, `parent_id`),
CONSTRAINT `guacamole_connection_group_ibfk_1`
FOREIGN KEY (`parent_group_id`)
FOREIGN KEY (`parent_id`)
REFERENCES `guacamole_connection_group` (`connection_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -26,10 +26,13 @@ CREATE TABLE `guacamole_connection_group` (
-- Changes to connection table to support grouping.
--
ALTER TABLE `guacamole_connection` ADD COLUMN `connection_group_id` int(11) AFTER `connection_name`;
ALTER TABLE `guacamole_connection` ADD COLUMN `parent_id` int(11) AFTER `connection_name`;
ALTER TABLE `guacamole_connection` DROP INDEX `connection_name_parent`;
ALTER TABLE `guacamole_connection` ADD UNIQUE KEY `connection_name_parent` (`connection_name`, `parent_id`);
ALTER TABLE `guacamole_connection` ADD CONSTRAINT `guacamole_connection_ibfk_1`
FOREIGN KEY (`connection_group_id`)
FOREIGN KEY (`parent_id`)
REFERENCES `guacamole_connection_group` (`connection_group_id`);
--