[PR #6425] [MERGED] fix(prisma-adapter): extract id to root level for delete operations #6657

Closed
opened 2026-03-13 13:07:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6425
Author: @ping-maxwell
Created: 11/30/2025
Status: Merged
Merged: 12/16/2025
Merged by: @Bekacru

Base: canaryHead: fix/prisma-delete-id-root


📝 Commits (5)

  • 03df19f fix(prisma-adapter): extract id to root level for delete operations
  • a6d3478 Apply suggestions from code review
  • 4700bf0 Merge branch 'canary' into fix/prisma-delete-id-root
  • 5b14b20 Merge branch 'canary' into fix/prisma-delete-id-root
  • ed97e03 Merge branch 'canary' into fix/prisma-delete-id-root

📊 Changes

1 file changed (+92 additions, -11 deletions)

View changed files

📝 packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (+92 -11)

📄 Description

Prisma requires id at the root level for delete operations. When multiple conditions were provided (e.g., id + userId), they were all placed in an AND array, causing delete operations to fail.

Now, for delete actions, the id condition is extracted to the root level while other AND conditions remain in the AND array.


Summary by cubic

Fix delete operations in the Prisma adapter by moving the id filter to the root where clause for delete. Prevents delete failures when id is combined with other filters.

  • Bug Fixes
    • Extracted id to the root for delete; other filters stay under AND/OR.
    • Updated convertWhereClause to accept action and handle delete-specific logic.
    • Refactored adapter methods to pass the action to convertWhereClause.

Written for commit ed97e03003. Summary will update automatically on new commits.


🔄 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/6425 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 11/30/2025 **Status:** ✅ Merged **Merged:** 12/16/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/prisma-delete-id-root` --- ### 📝 Commits (5) - [`03df19f`](https://github.com/better-auth/better-auth/commit/03df19f5967b0e674d07d6f1327e6b2b90afbd94) fix(prisma-adapter): extract `id` to root level for delete operations - [`a6d3478`](https://github.com/better-auth/better-auth/commit/a6d34782e722be950fb3fc1aa0ed70af7ae55e60) Apply suggestions from code review - [`4700bf0`](https://github.com/better-auth/better-auth/commit/4700bf0afcfc19e2e5f6582afef985ffc2b24ed6) Merge branch 'canary' into fix/prisma-delete-id-root - [`5b14b20`](https://github.com/better-auth/better-auth/commit/5b14b2041be0d4a4545df90ee8969e1e2006d176) Merge branch 'canary' into fix/prisma-delete-id-root - [`ed97e03`](https://github.com/better-auth/better-auth/commit/ed97e0300373b975f939155acca20a4633acdc49) Merge branch 'canary' into fix/prisma-delete-id-root ### 📊 Changes **1 file changed** (+92 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts` (+92 -11) </details> ### 📄 Description Prisma requires `id` at the root level for delete operations. When multiple conditions were provided (e.g., `id` + `userId`), they were all placed in an AND array, causing delete operations to fail. Now, for delete actions, the `id` condition is extracted to the root level while other AND conditions remain in the AND array. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix delete operations in the Prisma adapter by moving the id filter to the root where clause for delete. Prevents delete failures when id is combined with other filters. - **Bug Fixes** - Extracted id to the root for delete; other filters stay under AND/OR. - Updated convertWhereClause to accept action and handle delete-specific logic. - Refactored adapter methods to pass the action to convertWhereClause. <sup>Written for commit ed97e0300373b975f939155acca20a4633acdc49. Summary will update automatically on new commits.</sup> <!-- 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-03-13 13:07:01 -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#6657