mirror of https://github.com/apache/cloudstack.git
CS-16146 2.2.14 to 3.0.5 : Upgrade fails for Production DB
Reviewed-by: Anthony Xu Changes: - host_details should not contain duplicates - CloudStack always removes entire set of details and add new. - Maybe 2.2.14 had some bug causing the duplicate. - Added IGNORE to the ALTER sql to take care of duplicates in host_details.
This commit is contained in:
parent
397df5bb54
commit
34514d9ab5
|
|
@ -238,7 +238,7 @@ public class Upgrade304to305 extends Upgrade30xBase implements DbUpgrade {
|
|||
s_logger.debug("Unique key already exists on host_details - not adding new one");
|
||||
}else{
|
||||
//add the key
|
||||
PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER TABLE `cloud`.`host_details` ADD CONSTRAINT UNIQUE KEY `uk_host_id_name` (`host_id`, `name`)");
|
||||
PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER IGNORE TABLE `cloud`.`host_details` ADD CONSTRAINT UNIQUE KEY `uk_host_id_name` (`host_id`, `name`)");
|
||||
pstmtUpdate.executeUpdate();
|
||||
s_logger.debug("Unique key did not exist on host_details - added new one");
|
||||
pstmtUpdate.close();
|
||||
|
|
|
|||
Loading…
Reference in New Issue