feat(server/m7-379): heal existing artist+album mbid on rescan

This commit is contained in:
2026-05-04 19:03:12 -04:00
parent ab8fff834a
commit 6c6c4bc1e4
5 changed files with 82 additions and 0 deletions
+9
View File
@@ -74,3 +74,12 @@ WHERE a.id = $1
AND NOT EXISTS (SELECT 1 FROM albums al WHERE al.artist_id = a.id)
AND NOT EXISTS (SELECT 1 FROM tracks t WHERE t.artist_id = a.id)
RETURNING a.id;
-- name: SetArtistMbidIfNull :exec
-- M7 #379: heal MBID on existing artist rows during rescan. Idempotent —
-- only updates when the existing mbid is NULL, so concurrent scans don't
-- overwrite an existing value with a stale one.
UPDATE artists
SET mbid = $2,
updated_at = now()
WHERE id = $1 AND mbid IS NULL;