From 223cfdc37c4b3284b2327893dc07bcd93751f018 Mon Sep 17 00:00:00 2001 From: kishan Date: Fri, 3 Feb 2012 13:31:38 +0530 Subject: [PATCH] Bug 13433: Updated removed index for async_job table Reviewed-By: Nitin --- .../com/cloud/upgrade/dao/Upgrade2213to2214.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java b/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java index 9f36a296e1f..97e08d72811 100755 --- a/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java +++ b/server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java @@ -138,5 +138,19 @@ public class Upgrade2213to2214 implements DbUpgrade { } catch (SQLException e) { throw new CloudRuntimeException("Unable to update primary key for netapp_volume", e); } + + //Drop i_async__removed, i_async_job__removed (if exists) and add i_async_job__removed + keys = new ArrayList(); + keys.add("i_async__removed"); + keys.add("i_async_job__removed"); + DbUpgradeUtils.dropKeysIfExist(conn, "cloud.async_job", keys, false); + try { + PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`async_job` ADD INDEX `i_async_job__removed`(`removed`)"); + pstmt.executeUpdate(); + pstmt.close(); + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to insert index for removed column in async_job", e); + } + } }