From c4948ea3db7e4015dfa8b1c231d75f1053ece4e1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 25 Feb 2013 20:23:44 +0100
Subject: [PATCH] Fix: It seems foreign key is not deleted sometimes. To be
 sure, we force delete also at end.

---
 htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 2 ++
 htdocs/install/mysql/migration/repair.sql      | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
index 3793e822102..dacb7519f28 100755
--- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
+++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
@@ -923,3 +923,5 @@ DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw';
 UPDATE llx_c_action_trigger SET code='FICHINTER_VALIDATE' WHERE code='FICHEINTER_VALIDATE';
 
 UPDATE llx_c_departements SET ncc='ALAVA', nom='Álava' WHERE code_departement='01' AND fk_region=419;
+
+ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur;
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 96b5da7d357..f27fb8cf95f 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -92,4 +92,4 @@ UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps
 -- DROP TABLE llx_expedition_methode;
 -- DROP TABLE llx_product_fournisseur;
 -- ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur;
-
+ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur;
-- 
GitLab