bug 10756: Removed constraints for the op_host_capacity table. op_host_capacity table is a table that is frequently updated and is only used in the background. There's no real reason for it to maintain data integrity with other tables. This change may introduce problems where data center, cluster, or pod is deleted and there are capacities entries left. However, this really should be in the application logic to do this deletion rather than relying on the database schema. Be sure to test these cases and make sure there are no data left over.

This commit is contained in:
Alex Huang 2011-07-19 10:15:14 -07:00
parent 6a27d11434
commit b92208c91c
2 changed files with 3 additions and 3 deletions

View File

@ -1042,11 +1042,8 @@ CREATE TABLE `cloud`.`op_host_capacity` (
`capacity_type` int(1) unsigned NOT NULL,
PRIMARY KEY (`id`),
INDEX `i_op_host_capacity__host_type`(`host_id`, `capacity_type`),
CONSTRAINT `fk_op_host_capacity__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `host_pod_ref` (`id`) ON DELETE CASCADE,
INDEX `i_op_host_capacity__pod_id`(`pod_id`),
CONSTRAINT `fk_op_host_capacity__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center` (`id`) ON DELETE CASCADE,
INDEX `i_op_host_capacity__data_center_id`(`data_center_id`),
CONSTRAINT `fk_op_host_capacity__cluster_id` FOREIGN KEY `fk_op_host_capacity__cluster_id` (`cluster_id`) REFERENCES `cloud`.`cluster`(`id`) ON DELETE CASCADE,
INDEX `i_op_host_capacity__cluster_id`(`cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -7,3 +7,6 @@ ALTER TABLE `cloud`.`domain` ADD COLUMN `network_domain` varchar(255);
ALTER TABLE `cloud`.`cluster` ADD CONSTRAINT `fk_cluster__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `cloud`.`data_center`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__pod_id`;
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__data_center_id`;
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__cluster_id`;