[PR #5553] [MERGED] fix: call db hooks when calling deleteUser #31680

Closed
opened 2026-04-17 22:34:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5553
Author: @ping-maxwell
Created: 10/24/2025
Status: Merged
Merged: 10/24/2025
Merged by: @himself65

Base: canaryHead: fix/call-db-hooks-on-delete-user


📝 Commits (2)

  • 5196a21 fix: Call DB hooks when calling deleteUser
  • dd42e91 Merge branch 'canary' into fix/call-db-hooks-on-delete-user

📊 Changes

2 files changed (+6 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/api/routes/update-user.ts (+0 -1)
📝 packages/better-auth/src/db/internal-adapter.ts (+6 -5)

📄 Description

This change now calls all 3 DB hooks when calling deleteUser:

  • session
  • account
  • user

Summary by cubic

Fixed deleteUser to call DB hooks for sessions, accounts, and user records so hooks run and data stays consistent.

  • Bug Fixes
    • Switched account deletion to use deleteManyWithHooks in the internal adapter.
    • Removed direct deleteAccounts call in the route; the adapter now handles account deletion and hooks.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5553 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 10/24/2025 **Status:** ✅ Merged **Merged:** 10/24/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/call-db-hooks-on-delete-user` --- ### 📝 Commits (2) - [`5196a21`](https://github.com/better-auth/better-auth/commit/5196a21905ba60a3f2b640156db29c1c5a34cfb9) fix: Call DB hooks when calling `deleteUser` - [`dd42e91`](https://github.com/better-auth/better-auth/commit/dd42e917f8184d8c8f1a0875c8ae439276c6cd25) Merge branch 'canary' into fix/call-db-hooks-on-delete-user ### 📊 Changes **2 files changed** (+6 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/update-user.ts` (+0 -1) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+6 -5) </details> ### 📄 Description This change now calls all 3 DB hooks when calling deleteUser: * session * account * user <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed deleteUser to call DB hooks for sessions, accounts, and user records so hooks run and data stays consistent. - **Bug Fixes** - Switched account deletion to use deleteManyWithHooks in the internal adapter. - Removed direct deleteAccounts call in the route; the adapter now handles account deletion and hooks. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:34:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#31680