Repository: cloudstack
Updated Branches:
  refs/heads/master 93c64cd7f -> 685a58a84


CLOUDSTACK-7210: removed duplicated foreign key from async_job_join_map table


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

Branch: refs/heads/master
Commit: 685a58a8433f914f788d5bbdbabd41662d3dd2f4
Parents: 93c64cd
Author: Alena Prokharchyk <alena.prokharc...@citrix.com>
Authored: Fri Aug 1 10:14:51 2014 -0700
Committer: Alena Prokharchyk <alena.prokharc...@citrix.com>
Committed: Fri Aug 1 10:48:36 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade441to450.java  | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/685a58a8/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java 
b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java
index d19fbed..21b2e13 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade441to450.java
@@ -60,6 +60,7 @@ public class Upgrade441to450 implements DbUpgrade {
     @Override
     public void performDataMigration(Connection conn) {
         dropInvalidKeyFromStoragePoolTable(conn);
+        dropDuplicatedForeignKeyFromAsyncJobTable(conn);
     }
 
 
@@ -80,9 +81,22 @@ public class Upgrade441to450 implements DbUpgrade {
         keys.add("id_2");
         uniqueKeys.put("storage_pool", keys);
 
-        s_logger.debug("Droping id_2 key from storage_pool table");
+        s_logger.debug("Dropping id_2 key from storage_pool table");
         for (Map.Entry<String, List<String>> entry: uniqueKeys.entrySet()) {
             DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), 
entry.getValue(), false);
         }
     }
+
+    private void dropDuplicatedForeignKeyFromAsyncJobTable(Connection conn) {
+        HashMap<String, List<String>> foreignKeys = new HashMap<String, 
List<String>>();
+        List<String> keys = new ArrayList<String>();
+
+        keys.add("fk_async_job_join_map__join_job_id");
+        foreignKeys.put("async_job_join_map", keys);
+
+        s_logger.debug("Dropping fk_async_job_join_map__join_job_id key from 
async_job_join_map table");
+        for (Map.Entry<String, List<String>> entry: foreignKeys.entrySet()) {
+            DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), 
entry.getValue(), true);
+        }
+    }
 }

Reply via email to