-- tracks.mbid holds the MusicBrainz *recording* MBID — the id the
-- ListenBrainz similarity pipeline (ListPlayedTracksNeedingSimilarity,
-- GetTracksByMBIDs) matches on. A single recording legitimately appears
-- on multiple releases (album + compilation + single), so multiple
-- tracks rows share one recording MBID.
--
-- tracks_mbid_unique (added in 0002, when this column was always NULL
-- and never populated) wrongly assumes one MBID == one track. Now that
-- the scanner extracts the recording MBID, that uniqueness throws
-- 23505 for any recording present on >1 release. Replace it with a
-- non-unique partial index serving the same lookups. Zero-risk: the
-- column is 100% NULL at migration time.

DROP INDEX IF EXISTS tracks_mbid_unique;
CREATE INDEX IF NOT EXISTS tracks_mbid_idx ON tracks (mbid) WHERE mbid IS NOT NULL;
