-- For You exploration attribution (milestone #127 step 2, Scribe #1249).
--
-- For You is deliberately composed of two populations: a head of
-- top-scored similarity matches ("taste" picks) and a tail sampled from
-- deeper in the candidate ranking ("fresh" picks — the freshness
-- injection). Until now the metrics could only judge For You as one
-- blob, so a high skip rate couldn't be read as "the taste engine is
-- missing" vs "the freshness tax is too high".
--
-- Two denormalized columns, both nullable:
--
-- 1. playlist_tracks.pick_kind — stamped by the system-playlist builder
--    at snapshot build time. NULL for manual playlists and for system
--    variants that don't split (Discover, Songs like X, discovery
--    mixes). System snapshots are atomically replaced daily, so the
--    column never goes stale within a snapshot.
--
-- 2. play_events.pick_kind — stamped at play-ingestion time by looking
--    the track up in the user's CURRENT For You snapshot. Attribution
--    must be frozen at play time: For You rebuilds daily, so a 30-day
--    metrics window spans ~30 snapshots and a join-at-read against the
--    live snapshot would misattribute nearly everything. Plays that
--    predate this feature (or whose track already rotated out, e.g. a
--    late offline replay) stay NULL → reported as unattributed.

ALTER TABLE playlist_tracks
    ADD COLUMN pick_kind text
    CONSTRAINT playlist_tracks_pick_kind_check
        CHECK (pick_kind IN ('taste', 'fresh'));

ALTER TABLE play_events
    ADD COLUMN pick_kind text
    CONSTRAINT play_events_pick_kind_check
        CHECK (pick_kind IN ('taste', 'fresh'));
