DB schema changes that will be needed for the host tags feature. This commit does not include any code changes for the feature.

This commit is contained in:
prachi 2011-01-05 13:53:57 -08:00
parent 1d25a33be1
commit b46a53579f
3 changed files with 20 additions and 0 deletions

View File

@ -50,6 +50,7 @@ ALTER TABLE `cloud`.`host` ADD CONSTRAINT `fk_host__cluster_id` FOREIGN KEY `fk_
ALTER TABLE `cloud`.`op_host` ADD CONSTRAINT `fk_op_host__id` FOREIGN KEY `fk_op_host__id`(`id`) REFERENCES `host`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`host_details` ADD CONSTRAINT `fk_host_details__host_id` FOREIGN KEY `fk_host_details__host_id`(`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`host_tags` ADD CONSTRAINT `fk_host_tags__host_id` FOREIGN KEY `fk_host_tags__host_id`(`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`storage_pool` ADD CONSTRAINT `fk_storage_pool__pod_id` FOREIGN KEY `fk_storage_pool__pod_id` (`pod_id`) REFERENCES `host_pod_ref` (`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`storage_pool` ADD INDEX `i_storage_pool__pod_id`(`pod_id`);

View File

@ -93,6 +93,7 @@ DROP TABLE IF EXISTS `cloud`.`port_forwarding_rules`;
DROP TABLE IF EXISTS `cloud`.`firewall_rules`;
DROP TABLE IF EXISTS `cloud`.`ssh_keypairs`;
DROP TABLE IF EXISTS `cloud`.`usage_event`;
DROP TABLE IF EXISTS `cloud`.`host_tags`;
CREATE TABLE `cloud`.`op_it_work` (
`id` char(40) COMMENT 'id',
@ -614,6 +615,13 @@ CREATE TABLE `cloud`.`mshost` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`host_tags` (
`id` bigint unsigned NOT NULL auto_increment,
`host_id` bigint unsigned NOT NULL COMMENT 'host id',
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`user` (
`id` bigint unsigned NOT NULL auto_increment,
`username` varchar(255) NOT NULL,
@ -1036,6 +1044,7 @@ CREATE TABLE `cloud`.`service_offering` (
`mc_rate` smallint unsigned default 10 COMMENT 'mcast rate throttle mbits/s',
`ha_enabled` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Enable HA',
`guest_ip_type` varchar(255) NOT NULL DEFAULT 'Virtualized' COMMENT 'Type of guest network -- direct or virtualized',
`host_tag` varchar(255) COMMENT 'host tag specified by the service_offering',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,10 @@
CREATE TABLE `cloud`.`host_tags` (
`id` bigint unsigned NOT NULL auto_increment,
`host_id` bigint unsigned NOT NULL COMMENT 'host id',
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`host_tags` ADD CONSTRAINT `fk_host_tags__host_id` FOREIGN KEY `fk_host_tags__host_id`(`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `host_tag` varchar(255);