Eli Mesika has uploaded a new change for review.

Change subject: core:upgrade fails on drop for new table added...
......................................................................

core:upgrade fails on drop for new table added...

core:upgrade fails on drop for new table added: 
fk_vm_interface_vm_static_template

This bug is a result of new FK introduced while there is an inconsistent
data in the database that violates this constraint.
The patch deletes inconsistent data prior of the FK creation.

Change-Id: I38bd0f1db5c2f4be2205f923f2dcf08feb0a2b59
Signed-off-by: Eli Mesika <[email protected]>
Bug-Url:https://bugzilla.redhat.com/890179
---
M 
backend/manager/dbscripts/upgrade/03_01_1520_add_fk_vm_interface_vm_static_template.sql
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/10380/1

diff --git 
a/backend/manager/dbscripts/upgrade/03_01_1520_add_fk_vm_interface_vm_static_template.sql
 
b/backend/manager/dbscripts/upgrade/03_01_1520_add_fk_vm_interface_vm_static_template.sql
index f52828d..bca8283 100644
--- 
a/backend/manager/dbscripts/upgrade/03_01_1520_add_fk_vm_interface_vm_static_template.sql
+++ 
b/backend/manager/dbscripts/upgrade/03_01_1520_add_fk_vm_interface_vm_static_template.sql
@@ -1,2 +1,4 @@
+-- delete inconsistent data
+DELETE FROM vm_interface where vmt_guid not in (SELECT vm_guid FROM vm_static);
 ALTER TABLE vm_interface ADD  CONSTRAINT FK_vm_interface_vm_static_template 
FOREIGN KEY(vmt_guid)
 REFERENCES vm_static(vm_guid) ON DELETE CASCADE;


--
To view, visit http://gerrit.ovirt.org/10380
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38bd0f1db5c2f4be2205f923f2dcf08feb0a2b59
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to