FIX Clean orphan records in llx_ecm_files into repair script.

This commit is contained in:
Laurent Destailleur 2020-10-26 18:31:12 +01:00
parent adeddc70ca
commit 3ee618d736

View File

@ -185,6 +185,7 @@ delete from llx_categorie_project where fk_categorie not in (select rowid from l
-- Fix: delete orphelins in ecm_files
delete from llx_ecm_files where src_object_type = 'expensereport' and src_object_id NOT IN (select rowid from llx_expensereport);
delete from llx_ecm_files where (src_object_type = 'contrat' OR src_object_type = 'contract') and src_object_id NOT IN (select rowid from llx_contrat);
-- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.
delete from llx_livraisondet where fk_livraison not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_livraison not in (select fk_source from llx_element_element where sourcetype = 'delivery');