Skip to content

Commit

Permalink
fix(migrate_taxref): ignore false merge conflicts
Browse files Browse the repository at this point in the history
Fix #527.
  • Loading branch information
jpm-cbna committed Aug 7, 2024
1 parent 14532af commit 1d19638
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down

0 comments on commit 1d19638

Please sign in to comment.