reindex postcodes that loose their parents

When the parent place of a postcode is deleted, it needs to
be reindexed to get a new parent. Otherwise displaying of
results is broken.
This commit is contained in:
Sarah Hoffmann
2024-05-04 10:16:14 +02:00
parent 332de72045
commit 77631f90fd
7 changed files with 43 additions and 2 deletions

View File

@@ -1399,6 +1399,8 @@ BEGIN
{% if debug %}RAISE WARNING 'placex_delete:12 % %',OLD.osm_type,OLD.osm_id;{% endif %}
UPDATE location_postcode SET indexed_status = 2 WHERE parent_place_id = OLD.place_id;
RETURN OLD;
END;

View File

@@ -81,6 +81,9 @@ CREATE INDEX IF NOT EXISTS idx_postcode_postcode
type TEXT,
deferred BOOLEAN
);
---
CREATE INDEX IF NOT EXISTS idx_location_postcode_parent_place_id
ON location_postcode USING BTREE (parent_place_id) {{db.tablespace.address_index}};
{% endif %}
-- Indices only needed for search.