[PR #5682] [MERGED] fix(adapter): drizzle deleteMany result should be a number #23056

Closed
opened 2026-04-15 21:27:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: canaryHead: fix/adapter-drizzle-neon-deleteMany-num-result


📝 Commits (10+)

  • b998ed4 fix(adapter): drizzle deleteMany result should be a number
  • 0bccd24 Update packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts
  • c111f0e chore: lint
  • 243e75d Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • 610af9a Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • cb4cfe7 Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • e8b09cf Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • 242562a Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • 2ef05c9 Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result
  • 0da5c54 Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result

📊 Changes

1 file changed (+17 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts (+17 -1)

📄 Description

For Neon drizzle driver, the result is an object with other data. We expect the result of deleteMany to be a number representing the number of rows deleted. This PR fixes this specific bug with neon driver, as well as having additional code to catch unexpected cases with non-numeric return values to warn in the console for them to open an issue as that's not expected.


Summary by cubic

Fixes deleteMany in the Drizzle adapter to always return the number of deleted rows. Normalizes Neon driver’s object result and adds safeguards for unexpected return shapes.

  • Bug Fixes
    • Normalize deleteMany results: use rowCount, array length, affectedRows, rowsAffected, or changes to compute a number.
    • Log an error with context if the result isn’t numeric to surface adapter issues.

Written for commit a1b3ba18eb. 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/5682 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 10/30/2025 **Status:** ✅ Merged **Merged:** 11/7/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/adapter-drizzle-neon-deleteMany-num-result` --- ### 📝 Commits (10+) - [`b998ed4`](https://github.com/better-auth/better-auth/commit/b998ed4b591c262d7f709cfcbcea9d697e63b51d) fix(adapter): drizzle `deleteMany` result should be a number - [`0bccd24`](https://github.com/better-auth/better-auth/commit/0bccd24279f1f2f560dd1b363cbed13aa33fcd79) Update packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts - [`c111f0e`](https://github.com/better-auth/better-auth/commit/c111f0ecfef0b2bc3e04c8c16da86f9379eac3ac) chore: lint - [`243e75d`](https://github.com/better-auth/better-auth/commit/243e75db8ab8ca88578a3289c968b7e902015d9f) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`610af9a`](https://github.com/better-auth/better-auth/commit/610af9ad3be876b3b69c6a03d768fc5564e7df73) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`cb4cfe7`](https://github.com/better-auth/better-auth/commit/cb4cfe75a2833e832c6ce89cad77ba5817672c57) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`e8b09cf`](https://github.com/better-auth/better-auth/commit/e8b09cfe43070c66e6a7d3b2eaa4a233240dd4a3) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`242562a`](https://github.com/better-auth/better-auth/commit/242562a5b22a8858eba2d6bf7200a61b97040230) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`2ef05c9`](https://github.com/better-auth/better-auth/commit/2ef05c98dda00a5a210caa7e85147e4864e662ed) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result - [`0da5c54`](https://github.com/better-auth/better-auth/commit/0da5c54bd77634e4e9061c4935c4434988939b77) Merge branch 'canary' into fix/adapter-drizzle-neon-deleteMany-num-result ### 📊 Changes **1 file changed** (+17 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts` (+17 -1) </details> ### 📄 Description For Neon drizzle driver, the result is an object with other data. We expect the result of `deleteMany` to be a number representing the number of rows deleted. This PR fixes this specific bug with neon driver, as well as having additional code to catch unexpected cases with non-numeric return values to warn in the console for them to open an issue as that's not expected. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes deleteMany in the Drizzle adapter to always return the number of deleted rows. Normalizes Neon driver’s object result and adds safeguards for unexpected return shapes. - **Bug Fixes** - Normalize deleteMany results: use rowCount, array length, affectedRows, rowsAffected, or changes to compute a number. - Log an error with context if the result isn’t numeric to surface adapter issues. <sup>Written for commit a1b3ba18ebb25b4782325f58030f5a862a031f69. 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-04-15 21:27:17 -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#23056