-- Restore the 0020 fixed-allowlist CHECKs. FAILS if any row holds a
-- source value outside the allowlist (the exact case 0030 enables) —
-- normalise such rows before rolling back.

ALTER TABLE albums DROP CONSTRAINT IF EXISTS albums_cover_art_source_check;
ALTER TABLE albums
    ADD CONSTRAINT albums_cover_art_source_check
    CHECK (cover_art_source IS NULL
           OR cover_art_source IN ('embedded','sidecar','mbcaa','theaudiodb','deezer','lastfm','none'));

ALTER TABLE artists DROP CONSTRAINT IF EXISTS artists_artist_art_source_check;
ALTER TABLE artists
    ADD CONSTRAINT artists_artist_art_source_check
    CHECK (artist_art_source IS NULL
           OR artist_art_source IN ('theaudiodb','deezer','lastfm','none'));
