mirror of https://github.com/apache/cloudstack.git
bug 13508: fixed inconsistencies in key names during db upgrade
status 13508: resolved fixed Reviewed-by: Will Chan
This commit is contained in:
parent
dc528dcc7d
commit
cf807faa7a
|
|
@ -195,7 +195,7 @@ public class Upgrade2213to2214 implements DbUpgrade {
|
|||
throw new CloudRuntimeException("Unable to insert foreign key in security_group table ", e);
|
||||
}
|
||||
|
||||
//Drop securityGroup keys (if exists) and insert one with correct name
|
||||
//Drop vmInstance keys (if exists) and insert one with correct name
|
||||
keys = new ArrayList<String>();
|
||||
keys.add("i_vm_instance__host_id");
|
||||
keys.add("fk_vm_instance__host_id");
|
||||
|
|
@ -225,6 +225,30 @@ public class Upgrade2213to2214 implements DbUpgrade {
|
|||
throw new CloudRuntimeException("Unable to insert foreign key in vm_instance table ", e);
|
||||
}
|
||||
|
||||
//Drop user_ip_address keys (if exists) and insert one with correct name
|
||||
keys = new ArrayList<String>();
|
||||
keys.add("fk_user_ip_address__account_id");
|
||||
keys.add("i_user_ip_address__account_id");
|
||||
|
||||
keys.add("fk_user_ip_address__vlan_db_id");
|
||||
keys.add("i_user_ip_address__vlan_db_id");
|
||||
|
||||
keys.add("fk_user_ip_address__data_center_id");
|
||||
keys.add("i_user_ip_address__data_center_id");
|
||||
|
||||
DbUpgradeUtils.dropKeysIfExist(conn, "cloud.user_ip_address", keys, true);
|
||||
DbUpgradeUtils.dropKeysIfExist(conn, "cloud.user_ip_address", keys, false);
|
||||
try {
|
||||
PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`user_ip_address` ADD CONSTRAINT `fk_user_ip_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`)");
|
||||
pstmt.executeUpdate();
|
||||
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`user_ip_address` ADD CONSTRAINT `fk_user_ip_address__vlan_db_id` FOREIGN KEY (`vlan_db_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE");
|
||||
pstmt.executeUpdate();
|
||||
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`user_ip_address` ADD CONSTRAINT `fk_user_ip_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE");
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to insert foreign key in vm_instance table ", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,8 @@ ALTER TABLE `cloud`.`domain_router` MODIFY `stop_pending` int(1) unsigned NOT NU
|
|||
|
||||
|
||||
ALTER TABLE `cloud`.`service_offering` MODIFY `limit_cpu_use` tinyint(1) unsigned NOT NULL default '0' COMMENT 'Limit the CPU usage to service offering';
|
||||
ALTER TABLE `cloud`.`vm_instance` MODIFY `limit_cpu_use` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Limit the cpu usage to service offering';
|
||||
|
||||
UPDATE `cloud`.`configuration` SET `value`='false' WHERE `name`='agent.lb.enabled';
|
||||
UPDATE `cloud`.`configuration` SET `value`='false' WHERE `name`='agent.lb.enabled';
|
||||
|
||||
ALTER TABLE `cloud_usage`.`user_statistics` MODIFY `device_type` varchar(32) NOT NULL;
|
||||
Loading…
Reference in New Issue