Updated Branches: refs/heads/4.2 8be9a4754 -> 5fb06ad37
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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5fb06ad3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5fb06ad3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5fb06ad3 Branch: refs/heads/4.2 Commit: 5fb06ad371961bae2469cde64e937b08ba0d2c87 Parents: 8be9a47 Author: Alena Prokharchyk <[email protected]> Authored: Mon Jul 29 10:31:59 2013 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Mon Jul 29 10:31:59 2013 -0700 ---------------------------------------------------------------------- setup/db/db/schema-307to410-cleanup.sql | 15 ++++++++++++++- setup/db/db/schema-307to410.sql | 10 +++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5fb06ad3/setup/db/db/schema-307to410-cleanup.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-307to410-cleanup.sql b/setup/db/db/schema-307to410-cleanup.sql index 984a683..6a9e2af 100644 --- a/setup/db/db/schema-307to410-cleanup.sql +++ b/setup/db/db/schema-307to410-cleanup.sql @@ -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)'; + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5fb06ad3/setup/db/db/schema-307to410.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-307to410.sql b/setup/db/db/schema-307to410.sql index 414d3bc..be6c17d 100644 --- a/setup/db/db/schema-307to410.sql +++ b/setup/db/db/schema-307to410.sql @@ -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; \ No newline at end of file +) 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)';
