Clean corrupted data for categories
Conflicts: htdocs/install/mysql/migration/repair.sql
This commit is contained in:
parent
6968304641
commit
4ecfa1d6e0
@ -55,6 +55,18 @@ delete from llx_product_extrafields where fk_object not in (select rowid from ll
|
||||
--delete from llx_societe_commerciaux where fk_soc not in (select rowid from llx_societe);
|
||||
|
||||
|
||||
-- Fix: delete category child with no category parent.
|
||||
drop table tmp_categorie;
|
||||
create table tmp_categorie as select * from llx_categorie;
|
||||
-- select * from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0;
|
||||
delete from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0;
|
||||
drop table tmp_categorie;
|
||||
-- Fix: delete orphelin category.
|
||||
delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0);
|
||||
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
|
||||
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
||||
|
||||
|
||||
-- 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');
|
||||
delete from llx_livraison where rowid not in (select fk_target from llx_element_element where targettype = 'delivery') AND rowid not in (select fk_source from llx_element_element where sourcetype = 'delivery');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user