diff --git a/.changes/unreleased/Feature-20240719-134241.yaml b/.changes/unreleased/Feature-20240719-134241.yaml new file mode 100644 index 000000000..89460cfc4 --- /dev/null +++ b/.changes/unreleased/Feature-20240719-134241.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Do not update the "createdAt" column when importing postal code which does not + change +time: 2024-07-19T13:42:41.208629736+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php index 5f7f52d72..36979ec87 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php @@ -42,7 +42,8 @@ class PostalCodeBaseImporter NOW(), NOW() FROM g - ON CONFLICT (code, refpostalcodeid, postalcodeSource) WHERE refpostalcodeid IS NOT NULL DO UPDATE SET label = excluded.label, center = excluded.center, updatedAt = NOW() + ON CONFLICT (code, refpostalcodeid, postalcodeSource) WHERE refpostalcodeid IS NOT NULL DO UPDATE + SET label = excluded.label, center = excluded.center, updatedAt = CASE WHEN NOT st_equals(excluded.center, chill_main_postal_code.center) OR excluded.label != chill_main_postal_code.label THEN NOW() ELSE chill_main_postal_code.updatedAt END SQL; private const VALUE = '(?, ?, ?, ?, ?, ?, ?, ?)';