Bug 13423: Upgrade 2213 to 2214 add the snapshot index since it was introduced for 2214.

Reviewed-By: Kishan
This commit is contained in:
Nitin Mehta 2012-02-02 19:20:43 +05:30
parent 85a5253405
commit e7f6ffbd43
2 changed files with 13 additions and 2 deletions

View File

@ -93,6 +93,18 @@ public class Upgrade2213to2214 implements DbUpgrade {
throw new CloudRuntimeException("Unable to execute cloud_usage usage_event table update", e);
}
//Drop i_snapshots__removed key (if exists) and re-add it again
keys = new ArrayList<String>();
keys.add("i_snapshots__removed");
DbUpgradeUtils.dropKeysIfExist(conn, "snapshots.removed", keys, false);
try {
PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`snapshots` ADD INDEX `i_snapshots__removed`(`removed`)");
pstmt.executeUpdate();
pstmt.close();
} catch (SQLException e) {
throw new CloudRuntimeException("Unable to insert index for removed column in snapshots", e);
}
//Drop netapp_volume primary key and add it again
DbUpgradeUtils.dropPrimaryKeyIfExists(conn, "cloud.netapp_volume");
try {

View File

@ -3,8 +3,7 @@
--;
ALTER TABLE `cloud`.`vm_template` MODIFY `extractable` int(1) unsigned NOT NULL default 0 COMMENT 'Is this template extractable';
ALTER TABLE `cloud`.`snapshots` ADD INDEX `i_snapshots__removed`(`removed`);
INSERT INTO configuration (category, instance, component, name, value, description) VALUES ('Advanced', 'DEFAULT', 'management-server', 'external.network.stats.interval', '300', 'Interval (in seconds) to report external network statistics.');
INSERT IGNORE INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Advanced', 'DEFAULT', 'management-server', 'external.network.stats.interval', '300', 'Interval (in seconds) to report external network statistics.');
CREATE TABLE `cloud`.`mshost_peer` (
`id` bigint unsigned NOT NULL auto_increment,