mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Do not update the createdAt column when importing postal code which does not change
The conflict resolution clause in the SQL command of the PostalCodeBaseImporter service has been updated. It now only changes the 'updatedAt' timestamp if either the 'center' position or the 'label' actually differs from the existing entry. This ensures that the 'updatedAt' field reflects when meaningful changes occurred.
This commit is contained in:
parent
19accc4d00
commit
ad5e780936
6
.changes/unreleased/Feature-20240719-134241.yaml
Normal file
6
.changes/unreleased/Feature-20240719-134241.yaml
Normal file
@ -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: ""
|
@ -42,7 +42,8 @@ class PostalCodeBaseImporter
|
|||||||
NOW(),
|
NOW(),
|
||||||
NOW()
|
NOW()
|
||||||
FROM g
|
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;
|
SQL;
|
||||||
|
|
||||||
private const VALUE = '(?, ?, ?, ?, ?, ?, ?, ?)';
|
private const VALUE = '(?, ?, ?, ?, ?, ?, ?, ?)';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user