mirror of https://github.com/apache/cloudstack.git
Cloudstack-4100 preserve data in iso_id column while upgrading from 3.0.7 to 4.2
Conflicts: engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
This commit is contained in:
parent
3de6cdb4f9
commit
e55844c364
|
|
@ -104,6 +104,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
fixNiciraKeys(conn);
|
||||
fixRouterKeys(conn);
|
||||
encryptSite2SitePSK(conn);
|
||||
migrateDatafromIsoIdInVolumesTable(conn);
|
||||
}
|
||||
|
||||
private void fixBaremetalForeignKeys(Connection conn) {
|
||||
|
|
@ -2115,4 +2116,23 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void migrateDatafromIsoIdInVolumesTable(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
pstmt = conn.prepareStatement("SELECT iso_id1 From `cloud`.`volumes`");
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`volumes` DROP COLUMN `iso_id`");
|
||||
pstmt.executeUpdate();
|
||||
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id1` `iso_id` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created'");
|
||||
pstmt.executeUpdate();
|
||||
}
|
||||
}catch (SQLException e) {
|
||||
//implies iso_id1 is not present, so do nothing.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1572,4 +1572,4 @@ ALTER TABLE `cloud_usage`.`usage_storage` CHANGE COLUMN `virtual_size` `virtual_
|
|||
ALTER TABLE `cloud_usage`.`cloud_usage` CHANGE COLUMN `virtual_size` `virtual_size1` bigint unsigned;
|
||||
|
||||
ALTER TABLE `cloud`.`network_offerings` CHANGE COLUMN `concurrent_connections` `concurrent_connections1` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';
|
||||
ALTER TABLE `cloud`.`volumes` DROP COLUMN `iso_id`;
|
||||
ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id1` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created';
|
||||
Loading…
Reference in New Issue