Updated Branches: refs/heads/4.1 cc58b7b85 -> 373c927a1
IPv6: Fix db upgrade path All the table column should be modified before view was added Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/373c927a Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/373c927a Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/373c927a Branch: refs/heads/4.1 Commit: 373c927a1e052f8fff23a4287486645bc65b1314 Parents: cc58b7b Author: Sheng Yang <[email protected]> Authored: Tue Feb 19 21:23:59 2013 -0800 Committer: Sheng Yang <[email protected]> Committed: Tue Feb 19 21:23:59 2013 -0800 ---------------------------------------------------------------------- setup/db/db/schema-40to410.sql | 68 +++++++++++++++++----------------- 1 files changed, 34 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/373c927a/setup/db/db/schema-40to410.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 3b03f6e..529d466 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -150,6 +150,40 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.max', '25', 'Max allowed number of APIs within fixed interval'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.cachesize', '50000', 'Account based API count cache size'); +CREATE TABLE `cloud`.`user_ipv6_address` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `uuid` varchar(40), + `account_id` bigint unsigned NULL, + `domain_id` bigint unsigned NULL, + `ip_address` char(50) NOT NULL, + `data_center_id` bigint unsigned NOT NULL COMMENT 'zone that it belongs to', + `vlan_id` bigint unsigned NOT NULL, + `state` char(32) NOT NULL default 'Free' COMMENT 'state of the ip address', + `mac_address` varchar(40) NOT NULL COMMENT 'mac address of this ip', + `source_network_id` bigint unsigned NOT NULL COMMENT 'network id ip belongs to', + `network_id` bigint unsigned COMMENT 'network this public ip address is associated with', + `physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on', + `created` datetime NULL COMMENT 'Date this ip was allocated to someone', + PRIMARY KEY (`id`), + UNIQUE (`ip_address`, `source_network_id`), + CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`), + CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`), + CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'IPv6 gateway for this network'; +ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'IPv6 cidr for this network'; + +ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'gateway for ip6 address'; +ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'cidr for ip6 address'; + +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_gateway` varchar(255); +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_cidr` varchar(255); +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_range` varchar(255); -- DB views for list api @@ -1308,37 +1342,3 @@ ALTER TABLE `cloud`.`domain` ADD COLUMN `region_id` int unsigned NOT NULL DEFAUL ALTER TABLE `cloud_usage`.`account` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; -CREATE TABLE `cloud`.`user_ipv6_address` ( - `id` bigint unsigned NOT NULL UNIQUE auto_increment, - `uuid` varchar(40), - `account_id` bigint unsigned NULL, - `domain_id` bigint unsigned NULL, - `ip_address` char(50) NOT NULL, - `data_center_id` bigint unsigned NOT NULL COMMENT 'zone that it belongs to', - `vlan_id` bigint unsigned NOT NULL, - `state` char(32) NOT NULL default 'Free' COMMENT 'state of the ip address', - `mac_address` varchar(40) NOT NULL COMMENT 'mac address of this ip', - `source_network_id` bigint unsigned NOT NULL COMMENT 'network id ip belongs to', - `network_id` bigint unsigned COMMENT 'network this public ip address is associated with', - `physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on', - `created` datetime NULL COMMENT 'Date this ip was allocated to someone', - PRIMARY KEY (`id`), - UNIQUE (`ip_address`, `source_network_id`), - CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`), - CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`), - CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'IPv6 gateway for this network'; -ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'IPv6 cidr for this network'; - -ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'gateway for ip6 address'; -ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'cidr for ip6 address'; - -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_gateway` varchar(255); -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_cidr` varchar(255); -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_range` varchar(255);
