CLOUDSTACK-3898: fixed 303-42 db upgrade - handle situation when the field is already inserted, when try to insert it again with 41-42 upgrade

This commit is contained in:
Alena Prokharchyk 2013-07-29 10:31:59 -07:00
parent 54bca94307
commit 399c37345d
2 changed files with 23 additions and 2 deletions

View File

@ -19,10 +19,23 @@
-- Schema cleanup from 3.0.7 to 4.1.0
--;
# Drop the field introduced as a part of 410-420 upgrade and re-enable it back
# Drop the fields introduced as a part of 410-420 upgrade and re-enable it back
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `eip_associate_public_ip`;
ALTER TABLE `cloud`.`network_offerings` CHANGE COLUMN `eip_associate_public_ip_1` `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
ALTER TABLE `cloud`.`usage_event` DROP COLUMN `virtual_size`;
ALTER TABLE `cloud_usage`.`usage_event` DROP COLUMN `virtual_size`;
ALTER TABLE `cloud_usage`.`usage_storage` DROP COLUMN `virtual_size`;
ALTER TABLE `cloud_usage`.`cloud_usage` DROP COLUMN `virtual_size`;
ALTER TABLE `cloud`.`usage_event` CHANGE COLUMN `virtual_size1` `virtual_size` bigint unsigned;
ALTER TABLE `cloud_usage`.`usage_event` CHANGE COLUMN `virtual_size1` `virtual_size` bigint unsigned;
ALTER TABLE `cloud_usage`.`usage_storage` CHANGE COLUMN `virtual_size1` `virtual_size` bigint unsigned;
ALTER TABLE `cloud_usage`.`cloud_usage` CHANGE COLUMN `virtual_size1` `virtual_size` bigint unsigned;
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `concurrent_connections`;
ALTER TABLE `cloud`.`network_offerings` CHANGE COLUMN `concurrent_connections1` `concurrent_connections` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';

View File

@ -1563,4 +1563,12 @@ CREATE TABLE `cloud`.`netscaler_pod_ref` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_ns_pod_ref__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_ns_pod_ref__device_id` FOREIGN KEY (`external_load_balancer_device_id`) REFERENCES `external_load_balancer_devices`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#rename the fields (we will rename them back in 307-41 cleanup)
ALTER TABLE `cloud`.`usage_event` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
ALTER TABLE `cloud_usage`.`usage_event` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
ALTER TABLE `cloud_usage`.`usage_storage` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
ALTER TABLE `cloud_usage`.`cloud_usage` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
ALTER TABLE `cloud`.`network_offerings` CHANGE COLUMN `concurrent_connections` `concurrent_connections1` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';