fix: scan backfills release type metadata onto pre-existing rows
MonitoredRelease rows created before an artist's discography was populated (e.g. an owned album recorded before _populate_discography ran) never got primaryType/secondaryTypes backfilled, wrongly excluding them from the studio-only core view. _populate_discography now DO UPDATEs the MB type metadata on conflict instead of DO NOTHING, leaving monitored/state/currentQualityClass/firstGrabbedAt untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,11 @@ def _populate_discography(conn, browser, watched_id, artist_mbid: str, artist_na
|
||||
'INSERT INTO "MonitoredRelease" (id, "watchedArtistId", "artistMbid", "artistName", '
|
||||
'"rgMbid", album, "primaryType", "secondaryTypes", "firstReleaseDate", monitored, state, "createdAt") '
|
||||
"VALUES (gen_random_uuid()::text, %s, %s, %s, %s, %s, %s, %s, %s, false, 'wanted', now()) "
|
||||
'ON CONFLICT ("rgMbid") DO NOTHING',
|
||||
'ON CONFLICT ("rgMbid") DO UPDATE SET '
|
||||
' "primaryType" = EXCLUDED."primaryType", '
|
||||
' "secondaryTypes" = EXCLUDED."secondaryTypes", '
|
||||
' "firstReleaseDate" = EXCLUDED."firstReleaseDate", '
|
||||
' "watchedArtistId" = COALESCE("MonitoredRelease"."watchedArtistId", EXCLUDED."watchedArtistId")',
|
||||
(watched_id, artist_mbid, artist_name, rg.rg_mbid, rg.title, rg.primary_type or None,
|
||||
list(rg.secondary_types), rg.first_release_date or None),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user