Updated Branches:
  refs/heads/master e4c51e92e -> aec6b4af4

[ASFCS40]Upgrade to 4.0: host_details unique key addition needs IGNORE keyword 
to correct the duplicates


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

Branch: refs/heads/master
Commit: aec6b4af48c407a8e055656f0183f8d6eae1c9e2
Parents: e4c51e9
Author: Prachi Damle <[email protected]>
Authored: Thu Aug 23 17:52:04 2012 -0700
Committer: Prachi Damle <[email protected]>
Committed: Thu Aug 23 17:52:04 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade302to40.java  |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aec6b4af/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade302to40.java 
b/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
index 198dafd..0a836e9 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade302to40.java
@@ -517,7 +517,7 @@ public class Upgrade302to40 extends Upgrade30xBase 
implements DbUpgrade {
                 s_logger.debug("Unique key already exists on host_details - 
not adding new one");
             }else{
                 //add the key
-                PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER 
TABLE `cloud`.`host_details` ADD CONSTRAINT UNIQUE KEY `uk_host_id_name` 
(`host_id`, `name`)");
+                PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER 
IGNORE TABLE `cloud`.`host_details` ADD CONSTRAINT UNIQUE KEY `uk_host_id_name` 
(`host_id`, `name`)");
                 pstmtUpdate.executeUpdate();
                 s_logger.debug("Unique key did not exist on host_details -  
added new one");
                 pstmtUpdate.close();

Reply via email to