From 847b5bc9835b9a4d1e1435d8d7565b4f604798bb Mon Sep 17 00:00:00 2001 From: kishan Date: Wed, 18 Jan 2012 14:04:40 +0530 Subject: [PATCH] Bug 12292: updated netapp_volume primary key for upgrades Status 12292: resolved fixed Reviewed-By: Nitin --- .../src/com/cloud/upgrade/dao/Upgrade2213to2214.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java b/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java index 42318961f1f..a91b6c26beb 100644 --- a/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java +++ b/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java @@ -80,5 +80,15 @@ public class Upgrade2213to2214 implements DbUpgrade { } catch (SQLException e) { throw new CloudRuntimeException("Unable to execute usage_event table update", e); } + + //Drop netapp_volume primary key and add it again + DbUpgradeUtils.dropPrimaryKeyIfExists(conn, "cloud.netapp_volume"); + try { + PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`netapp_volume` add PRIMARY KEY (`id`)"); + pstmt.executeUpdate(); + pstmt.close(); + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to update primary key for netapp_volume", e); + } } }