lydavid / MusicSearch

An Android app for browsing songs, artists, and anything related to them
https://lydavid.github.io/MusicSearch/
Apache License 2.0
53 stars 1 forks source link

split `area_place` into `areas_by_entity` and `places_by_entity` #1217

Open lydavid opened 3 weeks ago

lydavid commented 3 weeks ago

When refreshing a place, we call this:

-- 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.

lydavid commented 3 weeks ago

From #1216