Delete user: foreign key constraint issues #7
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: nonshy/website#7
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A user wanted their account deleted but were running into database constraint errors in doing so. The two specific errors encountered were:
In the first: the user had created two threads on the forum (ID 16 and 17) and the threads.comment_id column was referring to comments (ID 110, 111) that were trying to be deleted.
In the second: their profile photo wasn't removed because their users.profile_photo_id column still referenced its ID.
The deletion was unblocked by manually running Postgres queries to break the foreign key relationships:
These constraint errors were not seen on local dev with a SQLite3 database so seems to reproduce only on PostgreSQL. The delete_user.go module should probably need an update to better handle this case.