Files
thrilltrack-explorer/supabase/migrations/20251014234728_a5c67cd0-be0f-4966-af35-092d1856310f.sql
2025-10-14 23:48:34 +00:00

16 lines
727 B
SQL

-- Backfill missing privacy settings fields for existing users
UPDATE user_preferences
SET privacy_settings = privacy_settings || jsonb_build_object(
'show_avatar', COALESCE((privacy_settings->>'show_avatar')::boolean, true),
'show_bio', COALESCE((privacy_settings->>'show_bio')::boolean, true),
'show_activity_stats', COALESCE((privacy_settings->>'show_activity_stats')::boolean, true),
'show_home_park', COALESCE((privacy_settings->>'show_home_park')::boolean, false)
)
WHERE
privacy_settings IS NOT NULL
AND (
privacy_settings->>'show_avatar' IS NULL OR
privacy_settings->>'show_bio' IS NULL OR
privacy_settings->>'show_activity_stats' IS NULL OR
privacy_settings->>'show_home_park' IS NULL
);