-- Add three-tier visibility to songs and playlists.
-- Values: 'public' | 'logged_in' | 'private'
-- Default to 'logged_in' for any existing rows that had is_public = 0,
-- and 'public' for rows that had is_public = 1.

ALTER TABLE songs ADD COLUMN visibility TEXT NOT NULL DEFAULT 'logged_in';
ALTER TABLE playlists ADD COLUMN visibility TEXT NOT NULL DEFAULT 'logged_in';

UPDATE songs SET visibility = CASE WHEN is_public = 1 THEN 'public' ELSE 'logged_in' END;
UPDATE playlists SET visibility = CASE WHEN is_public = 1 THEN 'public' ELSE 'logged_in' END;
