fix db upgrade from 2.2.6 to 2.2.8

Conflicts:

	setup/db/db/schema-227to228.sql
This commit is contained in:
alena 2011-07-08 09:51:50 -07:00
parent 27ef3a1d2d
commit 62a570484c
2 changed files with 9 additions and 11 deletions

View File

@ -65,13 +65,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();
}
}
@ -109,12 +109,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

@ -85,7 +85,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',
@ -103,7 +103,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',
@ -130,10 +130,8 @@ 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;
CREATE INDEX `i_op_lock__mac_ip_thread` on `op_lock` (`mac`, `ip`, `thread`);
CREATE INDEX `i_op_lock__mac_ip_thread` on `op_lock` (`mac`, `ip`, `thread`);8