You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/04/15 10:05:43 UTC

[43/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784

disable foreign key checks when altering them

Upgrades from 4.4 where not working properly due to errors like this:
ERROR 1833 (HY000): Cannot change column 'id': used in a foreign key constraint 'fk_global_load_balancing_rules_region_id' of table 'cloud.global_load_balancing_rules'

The disabling of the checks is for the current session only, so it's safe.

In the 4.4 branch, this file used to be at:
client/target/utilities/scripts/db/db/schema-442to450.sql

It's now moved. We need to edit it in 4.4 and 4.5 to have it effective.

This closes #164

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8f4abbc7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8f4abbc7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8f4abbc7

Branch: refs/heads/reporter
Commit: 8f4abbc7bd65e7a7cad67ba64b29d745aa0869c0
Parents: bb4f234
Author: Remi Bergsma <gi...@remi.nl>
Authored: Mon Apr 13 16:38:17 2015 -0500
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 14 14:50:58 2015 +0530

----------------------------------------------------------------------
 setup/db/db/schema-442to450.sql | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f4abbc7/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index 4a8f250..774eee5 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -37,6 +37,7 @@ ALTER TABLE `cloud`.`volumes` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NUL
 ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume';
 
 -- Have primary keys of following table AUTO_INCREMENT
+SET foreign_key_checks = 0;
 ALTER TABLE `cloud`.`region` MODIFY `id` int unsigned AUTO_INCREMENT UNIQUE NOT NULL;
 ALTER TABLE `cloud`.`vm_instance` MODIFY `id` bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL;
 ALTER TABLE `cloud`.`user_vm` MODIFY `id` bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL;
@@ -44,6 +45,7 @@ ALTER TABLE `cloud`.`domain_router` MODIFY `id` bigint unsigned AUTO_INCREMENT U
 ALTER TABLE `cloud`.`service_offering` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
 ALTER TABLE `cloud`.`load_balancing_rules` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
 ALTER TABLE `cloud`.`port_forwarding_rules` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL;
+SET foreign_key_checks = 1;
 
 DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
 CREATE VIEW `cloud`.`disk_offering_view` AS