- Remove notification_logs table references (table doesn't exist) - This was causing the function to crash after sending email - Now the function should complete successfully - Added better email payload logging - Keep .env file for local development
31 lines
1.1 KiB
SQL
31 lines
1.1 KiB
SQL
-- ============================================================================
|
|
-- Clean Up User from Supabase Auth Completely
|
|
-- ============================================================================
|
|
|
|
-- NOTE: You CANNOT just DELETE from auth.users
|
|
-- Supabase keeps deleted users in a recycle bin
|
|
|
|
-- To completely remove a user, you need to use Supabase Auth Admin API
|
|
-- OR use a cascade delete from a linked table
|
|
|
|
-- Option 1: Delete via cascade (if you have foreign keys)
|
|
-- This works because auth_otps has ON DELETE CASCADE
|
|
DELETE FROM auth.users WHERE email = 'your@email.com';
|
|
|
|
-- Option 2: Check if user still exists in recycle bin
|
|
SELECT id, email, deleted_at
|
|
FROM auth.users
|
|
WHERE email = 'your@email.com';
|
|
|
|
-- If you see deleted_at IS NOT NULL, the user is in recycle bin
|
|
|
|
-- To permanently delete from recycle bin, you need to:
|
|
-- 1. Go to Supabase Dashboard → Authentication → Users
|
|
-- 2. Find the user
|
|
-- 3. Click "Permanently delete"
|
|
|
|
-- OR use the Auth Admin API from an edge function:
|
|
/*
|
|
const { data, error } = await supabase.auth.admin.deleteUser(userId);
|
|
*/
|