You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/07/14 15:37:22 UTC

[18/44] git commit: updated refs/heads/vpc-toolkit-hugo to 1ad1883

CLOUDSTACK-7081: db upgrade fixes - a) added description for cloud.volumes.iso_id field b) removed duplicated unique key "id_2" from cloud.storage_pool table


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

Branch: refs/heads/vpc-toolkit-hugo
Commit: f4d203475535839971d143d4c72a60d3f8b787c0
Parents: 89a326a
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Jul 8 14:02:07 2014 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Jul 8 14:14:07 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade440to450.java | 17 +++++++++++++++++
 setup/db/db/schema-440to450.sql                    |  2 ++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4d20347/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to450.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to450.java
index c1f853e..caf3b42 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to450.java
@@ -19,6 +19,9 @@ package com.cloud.upgrade.dao;
 
 import java.io.File;
 import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 
 import org.apache.log4j.Logger;
 
@@ -55,6 +58,7 @@ public class Upgrade440to450 implements DbUpgrade {
 
     @Override
     public void performDataMigration(Connection conn) {
+        dropInvalidKeyFromStoragePoolTable(conn);
     }
 
 
@@ -67,4 +71,17 @@ public class Upgrade440to450 implements DbUpgrade {
 
         return new File[] {new File(script)};
     }
+
+    private void dropInvalidKeyFromStoragePoolTable(Connection conn) {
+        HashMap<String, List<String>> uniqueKeys = new HashMap<String, List<String>>();
+        List<String> keys = new ArrayList<String>();
+
+        keys.add("id_2");
+        uniqueKeys.put("storage_pool", keys);
+
+        s_logger.debug("Droping id_2 key from storage_pool table");
+        for (String tableName : uniqueKeys.keySet()) {
+            DbUpgradeUtils.dropKeysIfExist(conn, tableName, uniqueKeys.get(tableName), false);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4d20347/setup/db/db/schema-440to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-440to450.sql b/setup/db/db/schema-440to450.sql
index 5fd6200..d047060 100644
--- a/setup/db/db/schema-440to450.sql
+++ b/setup/db/db/schema-440to450.sql
@@ -240,3 +240,5 @@ ALTER TABLE `cloud`.`user` ADD COLUMN domain_id bigint(20) unsigned DEFAULT NULL
 ALTER TABLE `cloud`.`user` ADD CONSTRAINT `fk_user__domain_id` FOREIGN KEY `fk_user__domain_id`(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE;
 UPDATE `cloud`.`user` SET `cloud`.`user`.domain_id=(SELECT `cloud`.`account`.domain_id   FROM `cloud`.`account`   WHERE `cloud`.`account`.id=`cloud`.`user`.account_id) where id > 0;
 ALTER TABLE `cloud`.`user` ADD UNIQUE KEY `username_domain_id` (`username`,`domain_id`);
+
+ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created';