-- Drop any audit rows under the scope the constraint is about to forbid,
-- otherwise re-adding the narrower CHECK fails against existing data.
DELETE FROM recommendation_tuning_audit WHERE scope = 'discover';
ALTER TABLE recommendation_tuning_audit
    DROP CONSTRAINT recommendation_tuning_audit_scope_check;
ALTER TABLE recommendation_tuning_audit
    ADD CONSTRAINT recommendation_tuning_audit_scope_check
    CHECK (scope IN ('radio', 'daily_mix', 'taste'));

DROP TABLE IF EXISTS discover_tuning;
