CLOUDSTACK-686: Modified unique constraint to include physical_network_id

This commit is contained in:
Kishan Kavala 2013-02-01 07:54:02 +05:30
parent c0b18c76f0
commit 33b87d8985
2 changed files with 5 additions and 1 deletions

View File

@ -670,7 +670,7 @@ CREATE TABLE `cloud`.`op_dc_vnet_alloc` (
PRIMARY KEY (`id`),
UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id__account_id`(`vnet`, `data_center_id`, `account_id`),
INDEX `i_op_dc_vnet_alloc__dc_taken`(`data_center_id`, `taken`),
UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `data_center_id`),
UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `physical_network_id`, `data_center_id`),
CONSTRAINT `fk_op_dc_vnet_alloc__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_op_dc_vnet_alloc__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1264,3 +1264,7 @@ CREATE VIEW `cloud`.`data_center_view` AS
`cloud`.`domain` ON data_center.domain_id = domain.id;
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'direct.agent.pool.size', '500', 'Default size for DirectAgentPool');
ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id;
ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `physical_network_id`, `data_center_id`);