Changes:
1. Created migration 004_create_upsert_function.sql:
- Creates upsert_user_profile() function with SECURITY DEFINER
- Bypasses RLS to allow profile creation/updates
- Only accessible to authenticated users via auth.uid()
2. Updated ProfileSettings.tsx:
- Changed from direct upsert to RPC function call
- Updated updateProfile() to use supabase.rpc()
- Updated updateNotificationSettings() to use same function
This solves the RLS policy violation by using a secure
server-side function that properly handles authentication.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>