Updated migration 003 to properly handle RLS:
- Make username nullable with default
- Drop all existing policies and recreate them
- Add proper INSERT policy with WITH CHECK clause
- Add UPDATE policy with both USING and WITH CHECK
This fixes RLS error blocking profile creation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
1. Created migration 003_fix_profile_creation.sql:
- Added INSERT policy for profiles table
- Made username nullable with default value
- Created upsert_profile function for safe upserts
2. Updated ProfileSettings.tsx:
- Changed from .update() to .upsert()
- Added id field to upsert data
- Added loadProfile() call after save to refresh state
This fixes the issue where users couldn't update their profile
because no profile row existed in the database.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>