From 1d196383b558db388bba43d4bcf14983288f6a7b Mon Sep 17 00:00:00 2001 From: Jean-Pascal MILCENT Date: Wed, 7 Aug 2024 18:02:51 +0200 Subject: [PATCH] fix(migrate_taxref): ignore false merge conflicts Fix #527. --- ..._taxref_changes_detections_cas_actions.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apptax/taxonomie/commands/migrate_taxref/data/changes_detection/1.2_taxref_changes_detections_cas_actions.sql b/apptax/taxonomie/commands/migrate_taxref/data/changes_detection/1.2_taxref_changes_detections_cas_actions.sql index ec9523b4..e47cc4ac 100755 --- a/apptax/taxonomie/commands/migrate_taxref/data/changes_detection/1.2_taxref_changes_detections_cas_actions.sql +++ b/apptax/taxonomie/commands/migrate_taxref/data/changes_detection/1.2_taxref_changes_detections_cas_actions.sql @@ -181,6 +181,35 @@ WHERE a.i_cd_ref = c.i_cd_ref AND a.f_cd_ref = c.f_cd_ref ; +-- ---------------------------------------------------------------------- +-- Medium & attributs: case "merge", detect "no change" for attributs +WITH cdref_maintained AS ( + SELECT + i_cd_ref AS cd_ref, + i_array_agg, + f_array_agg + FROM tmp_taxref_changes.comp_grap + WHERE i_cd_ref = f_cd_ref +), +no_cdref_change AS ( + SELECT + cg.i_cd_ref, + cg.f_cd_ref + FROM tmp_taxref_changes.comp_grap AS cg + JOIN cdref_maintained AS cm_i + ON (cm_i.cd_ref = cg.i_cd_ref AND cg.i_array_agg = cm_i.i_array_agg) + WHERE cg.cas = 'merge' + AND cg.grappe_change ILIKE '%cas3: f_cd_ref%' + AND cg.i_cd_ref != cg.f_cd_ref + AND cg.att_nb > 0 +) +UPDATE tmp_taxref_changes.comp_grap AS c SET + "action" = 'Do not change attributes and media' +FROM no_cdref_change AS ncc +WHERE c.i_cd_ref = ncc.i_cd_ref + AND c.f_cd_ref = ncc.f_cd_ref ; + + -- ---------------------------------------------------------------------- -- Medium & attributs: case "merge", detect conflicts for attributs WITH atts AS ( @@ -191,6 +220,7 @@ WITH atts AS ( WHERE valeur_attribut != '{}' AND valeur_attribut != '' AND cas = 'merge' + AND i_cd_ref != f_cd_ref ), conflict_atts AS ( SELECT