fix: song_identifiers uniqueness per song ā albums map to many songs
Second root cause of recoupable/chat#1794: the unique (platform, identifier_type, value) constraint was correct for track ids (1:1) but silently capped every album id at one mapped song ā GET /playcounts could never return more than one track per album by construction. Live-confirmed on preview: 18 track_id rows, 18 measurements, exactly 1 album_id row surviving the constraint.
Uniqueness moves to (song, platform, identifier_type, value); reverse lookups keep a non-unique index.
Merge order: this ā api#664 (which adds idempotent album-mapping for all captured tracks, healing existing data on the next snapshot).
š¤ Generated with Claude Code
Summary by cubic
Make album identifiers unique per song so albums can map to many songs. Fixes recoupable/chat#1794 where GET /playcounts returned only one track per album.
- Bug Fixes
- Set
public.song_identifiersuniqueness to(song, platform, identifier_type, value)and dropped the old one via catalog lookup (generated-name safe). - Added a non-unique index on
(platform, identifier_type, value)for reverse lookups.
- Set