Fix settings validation and session errors

This commit is contained in:
gpt-engineer-app[bot]
2025-10-14 23:48:34 +00:00
parent 439a7f4abf
commit 21d16f01ed
5 changed files with 62 additions and 29 deletions

View File

@@ -0,0 +1,16 @@
-- 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
);