-- Reverse 0041_discover_taste_unheard.up.sql.
--
-- Null out any rows stamped with the new value before shrinking the
-- CHECK back to the 0039 vocabulary, or the ADD CONSTRAINT would fail
-- on existing 'taste_unheard' rows (mirrors 0039's down).
UPDATE play_events SET pick_kind = NULL WHERE pick_kind = 'taste_unheard';
UPDATE playlist_tracks SET pick_kind = NULL WHERE pick_kind = 'taste_unheard';

ALTER TABLE playlist_tracks
    DROP CONSTRAINT playlist_tracks_pick_kind_check;
ALTER TABLE playlist_tracks
    ADD CONSTRAINT playlist_tracks_pick_kind_check
        CHECK (pick_kind IN (
            'taste', 'fresh',
            'dormant', 'cross_user', 'random',
            'tier1', 'tier2', 'tier3'
        ));

ALTER TABLE play_events
    DROP CONSTRAINT play_events_pick_kind_check;
ALTER TABLE play_events
    ADD CONSTRAINT play_events_pick_kind_check
        CHECK (pick_kind IN (
            'taste', 'fresh',
            'dormant', 'cross_user', 'random',
            'tier1', 'tier2', 'tier3'
        ));
