From 20950d785fd7a7b3eee9fec3acaac3e89f8c4078 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Mar 2012 17:25:53 +0100 Subject: [PATCH] Fix: Clean corrupted data to avoid migration errors --- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 2 ++ htdocs/install/mysql/migration/repair.sql | 3 +++ 2 files changed, 5 insertions(+) diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 00a3cc04b32..a7ac388cd7c 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -27,6 +27,8 @@ update llx_facture_rec set fk_projet = null where fk_projet not in (select rowid update llx_fichinter set fk_projet = null where fk_projet not in (select rowid from llx_projet); update llx_projet_task set fk_projet = null where fk_projet not in (select rowid from llx_projet); +update llx_commande set fk_user_author = null where fk_user_author not in (select rowid from llx_user); + ALTER TABLE llx_extrafields ADD COLUMN TYPE VARCHAR(8); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index a95aefca027..012f01bb2dd 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -34,6 +34,9 @@ update llx_facture_rec set fk_projet = null where fk_projet not in (select rowid update llx_fichinter set fk_projet = null where fk_projet not in (select rowid from llx_projet); update llx_projet_task set fk_projet = null where fk_projet not in (select rowid from llx_projet); +update llx_commande set fk_user_author = null where fk_user_author not in (select rowid from llx_user); + + DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid