mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Fix user creation errors by handling empty emails properly
Adjust user creation schema to allow null emails, update data handling to convert empty strings to null, and provide a SQL script to clean up existing duplicate empty email entries, resolving the `users_email_key` constraint violation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/aiHrulP
This commit is contained in:
1 parent
b886f317ca
commit
c77ea88e9d
5 files changed
+244
-4
No files matched your search
@@ -0,0 +1,28 @@
|
||||
-- Fix duplicate empty email constraint issue in production
|
||||
-- This script converts empty string emails to NULL to allow multiple users without email
|
||||
|
||||
-- Step 1: Update all empty string emails to NULL
|
||||
UPDATE users
|
||||
SET email = NULL
|
||||
WHERE email = '' OR email IS NULL OR TRIM(email) = '';
|
||||
|
||||
-- Step 2: Verify the change
|
||||
SELECT 'Users with NULL email:' as status, COUNT(*) as count
|
||||
FROM users
|
||||
WHERE email IS NULL;
|
||||
|
||||
-- Step 3: Verify no empty string emails remain
|
||||
SELECT 'Users with empty string email:' as status, COUNT(*) as count
|
||||
FROM users
|
||||
WHERE email = '';
|
||||
|
||||
-- Step 4: Show sample of updated users
|
||||
SELECT id, username,
|
||||
CASE
|
||||
WHEN email IS NULL THEN '[NULL]'
|
||||
ELSE email
|
||||
END as email_display,
|
||||
role
|
||||
FROM users
|
||||
ORDER BY username
|
||||
LIMIT 10;
|
||||
Reference in new issue
Block a user