Yaojia Wang 3843d07577 fix(backend): Fix foreign key constraint error in tenant registration
Root Cause:
- Schema mismatch between user_tenant_roles table (identity schema) and
  users/tenants tables (default/public schema)
- PostgreSQL FK constraints couldn't find referenced tables due to
  schema mismatch
- Error: "violates foreign key constraint FK_user_tenant_roles_tenants_tenant_id"

Solution:
1. Moved users and tenants tables to identity schema
2. Created migration MoveTablesToIdentitySchemaAndAddIndexes
3. All Identity module tables now in consistent identity schema
4. Added performance index for users.email lookups

Changes:
- Updated TenantConfiguration.cs to use identity schema
- Updated UserConfiguration.cs to use identity schema
- Created migration to move tables to identity schema
- Removed old AddPerformanceIndexes migration (referenced wrong schema)
- Created new AddPerformanceIndexes migration
- Added test script test-tenant-registration.ps1

Test Results:
- Tenant registration now works successfully
- User, Tenant, and UserTenantRole all insert correctly
- FK constraints validate properly
- Access token and refresh token generated successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:56:04 +01:00
2025-11-04 00:20:42 +01:00
2025-11-02 23:55:18 +01:00
2025-11-03 11:51:02 +01:00
2025-11-03 20:02:41 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-03 11:51:02 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-04 00:20:42 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
Description
No description provided
3.4 MiB
Languages
C# 88.5%
PowerShell 10.4%
Shell 0.8%
Dockerfile 0.3%