-- An area that does not have a type is the area for a place that has never been visited.
-- We only delete this one so that we don't delete the rest of its containment.
deleteAreaPlaceLink:
DELETE FROM area_place WHERE area_id IN (
SELECT a.id
FROM place p
INNER JOIN area_place ap ON p.id = ap.place_id
INNER JOIN area a ON a.id = ap.area_id
WHERE place_id = :placeId
AND a.type IS NULL
);
But if we had clicked on the most specific area for the place, there will be no area that has a null type, so we will never delete its area, preventing us from refreshing the place's area if it had changed upstream.
When refreshing a place, we call this:
But if we had clicked on the most specific area for the place, there will be no area that has a
null
type, so we will never delete its area, preventing us from refreshing the place's area if it had changed upstream.