fix db upgrade from 2.2.6 to 2.2.8

This commit is contained in:
Edison Su 2011-07-01 19:15:50 -07:00
parent 334f0cdddd
commit d548e8fc38
2 changed files with 12 additions and 8 deletions

View File

@ -67,13 +67,13 @@ public class Upgrade227to228 implements DbUpgrade {
while (rs.next()) {
long dcId = rs.getLong(1);
pstmt = conn.prepareStatement("select id from host where data_center_id=? and type='SecondaryStorage'");
pstmt.setLong(0, dcId);
pstmt.setLong(1, dcId);
ResultSet rs1 = pstmt.executeQuery();
if (rs1.next()) {
long secHostId = rs1.getLong(1);
pstmt = conn.prepareStatement("update snapshot set sechost_id=? where data_center_id=?");
pstmt.setLong(0, secHostId);
pstmt.setLong(0, dcId);
pstmt = conn.prepareStatement("update snapshots set sechost_id=? where data_center_id=?");
pstmt.setLong(1, secHostId);
pstmt.setLong(2, dcId);
pstmt.executeUpdate();
}
}
@ -112,12 +112,12 @@ public class Upgrade227to228 implements DbUpgrade {
for (Object[] network : networks) {
Long networkId = (Long) network[0];
pstmt = conn.prepareStatement("SELECT * from domain_network_ref where network_id=?");
pstmt.setLong(0, networkId);
pstmt.setLong(1, networkId);
rs = pstmt.executeQuery();
if (rs.next()) {
s_logger.debug("Setting network id=" + networkId + " as domain specific shared network");
pstmt = conn.prepareStatement("UPDATE networks set is_domain_specific=1 where id=?");
pstmt.setLong(0, networkId);
pstmt.setLong(1, networkId);
pstmt.executeUpdate();
}
rs.close();

View File

@ -86,7 +86,7 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `shared_source_nat_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides the shared source nat service';
CREATE TABLE `cloud`.`op_host_transfer` (
CREATE TABLE IF NOT EXISTS `cloud`.`op_host_transfer` (
`id` bigint unsigned UNIQUE NOT NULL COMMENT 'Id of the host',
`initial_mgmt_server_id` bigint unsigned COMMENT 'management server the host is transfered from',
`future_mgmt_server_id` bigint unsigned COMMENT 'management server the host is transfered to',
@ -104,7 +104,7 @@ ALTER TABLE `cloud`.`snapshots` ADD COLUMN `swift_name` varchar(255);
ALTER TABLE `cloud`.`snapshots` ADD COLUMN `sechost_id` bigint unsigned;
CREATE TABLE `cloud`.`swift` (
CREATE TABLE IF NOT EXISTS `cloud`.`swift` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`hostname` varchar(255),
`account` varchar(255) COMMENT ' account in swift',
@ -131,3 +131,7 @@ UPDATE IGNORE configuration set name='guest.domain.suffix' where name='domain.su
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'guest.domain.suffix', 'cloud.internal', 'Default domain name for vms inside virtualized networks fronted by router');
DELETE FROM configuration WHERE name='domain.suffix';
ALTER TABLE `cloud`.`user` ADD COLUMN `registration_token` varchar(255) default NULL;
ALTER TABLE `cloud`.`user` ADD COLUMN `is_registered` tinyint NOT NULL DEFAULT 0;
ALTER TABLE `cloud`.`data_center` ADD COLUMN `removed` datetime;