Bug: Staff DELETE has no FK protection for existing appointments #21
Reference in New Issue
Block a user
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?
Problem
Deleting a staff member who has existing appointments will either produce an ugly 500 error (FK constraint violation) or orphan records depending on the cascade config.
Context
Flagged in CEO review on PR #15. Merged without fix.
Fix
Before allowing delete, check for existing appointments referencing this staff member. If found, return a clear 409 error explaining the staff member cannot be deleted while they have appointments.
Impact
Uncaught 500 errors when deleting staff with appointments.
Fixed in PR #24 (merged 2026-03-17). See commit
43e50255.