capgo
capgo copied to clipboard
Cannot delete user from auth table
Describe the bug/issue When try to delete user from auth table it fail where it should work
fix that and add test for it @devin
I've created a PR to fix this issue: #1082
Problem Analysis
The issue was that users couldn't be deleted from the auth table due to incomplete implementation of the deletion process. Specifically:
- The on_user_delete.ts trigger wasn't properly handling DELETE operations - it was looking for body.record instead of body.old_record for deleted user data
- The trigger wasn't hashing emails before inserting into the deleted_account table
- The implementation wasn't aligned with the new queue-based approach for user deletion
Solution Implemented
The PR implements the following fixes:
- Updated the on_user_delete.ts trigger to properly handle DELETE operations by using body.old_record
- Added email hashing functionality in the trigger before inserting into deleted_account table
- Created a new migration file to document the update to the on_user_delete trigger
- Aligned the implementation with the new queue-based approach for user deletion
The changes ensure that when a user is deleted, their email is properly hashed and stored in the deleted_account table, and all related cleanup operations are performed correctly.