diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 637648be3ba..096b82a7768 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -497,3 +497,6 @@ CREATE TABLE llx_blockedlog_authority ) ENGINE=innodb; ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature); + +-- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 75e2e27ac2e..a5549d33b25 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -92,6 +92,9 @@ delete from llx_product_extrafields where fk_object not in (select rowid from ll update llx_product_batch set batch = '' where batch = 'Non défini'; update llx_product_batch set batch = '' where batch = 'Non défini'; +update llx_stock_mouvement set batch = null where batch = 'Non défini'; +update llx_stock_mouvement set batch = null where batch = 'Non défini'; + DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product); DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product); DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb);