mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	[ASFCS40]Upgrade to 4.0: host_details unique key addition needs IGNORE keyword to correct the duplicates
This commit is contained in:
		
							parent
							
								
									e4c51e92ef
								
							
						
					
					
						commit
						aec6b4af48
					
				| @ -517,7 +517,7 @@ public class Upgrade302to40 extends Upgrade30xBase implements DbUpgrade { | |||||||
|                 s_logger.debug("Unique key already exists on host_details - not adding new one"); |                 s_logger.debug("Unique key already exists on host_details - not adding new one"); | ||||||
|             }else{ |             }else{ | ||||||
|                 //add the key |                 //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(); |                 pstmtUpdate.executeUpdate(); | ||||||
|                 s_logger.debug("Unique key did not exist on host_details -  added new one"); |                 s_logger.debug("Unique key did not exist on host_details -  added new one"); | ||||||
|                 pstmtUpdate.close(); |                 pstmtUpdate.close(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user