From 715b2024cd2a6e83e75ca173b26e5024ba7c8b30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Feb 2016 17:17:41 +0100 Subject: [PATCH] Better repair script --- htdocs/install/mysql/migration/repair.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index fafe5a4ad9f..dbb2ee0b7df 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -113,6 +113,8 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, position) values -- Stock calculation on product +DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); + UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);