[PR #3048] [MERGED] feat(database-hooks): Allow passing id in DB hook create #4622

Closed
opened 2026-03-13 11:52:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3048
Author: @ping-maxwell
Created: 6/16/2025
Status: Merged
Merged: 6/20/2025
Merged by: @Bekacru

Base: mainHead: feat/database-hooks/allow-ids


📝 Commits (3)

  • 08bb65f feat(database-hooks): Allow passing id in DB hook create
  • 5a460fe chore: lint
  • dcea88d fix: tests failing

📊 Changes

4 files changed (+5 additions, -3 deletions)

View changed files

📝 docs/components/builder/index.tsx (+0 -1)
📝 packages/better-auth/src/adapters/create-adapter/index.ts (+4 -1)
📝 packages/better-auth/src/api/routes/email-verification.ts (+0 -1)
📝 packages/better-auth/src/db/with-hooks.ts (+1 -0)

📄 Description

It's the same to using a custom idGenerator, except configurable by the database hook which would in theory provide more data.

A use-case is to generate the id based on user info in the user before DB hook.

Solves https://discord.com/channels/1288403910284935179/1379190465588367540/1384217435535835216


🔄 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/3048 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 6/16/2025 **Status:** ✅ Merged **Merged:** 6/20/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/database-hooks/allow-ids` --- ### 📝 Commits (3) - [`08bb65f`](https://github.com/better-auth/better-auth/commit/08bb65f5b8f97a746c6e7776fbf6da0174e0306a) feat(database-hooks): Allow passing `id` in DB hook `create` - [`5a460fe`](https://github.com/better-auth/better-auth/commit/5a460fe2613df4d59f98ba334faf7c416237524b) chore: lint - [`dcea88d`](https://github.com/better-auth/better-auth/commit/dcea88db039cecc2d334b3735334bc46e9840157) fix: tests failing ### 📊 Changes **4 files changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/builder/index.tsx` (+0 -1) 📝 `packages/better-auth/src/adapters/create-adapter/index.ts` (+4 -1) 📝 `packages/better-auth/src/api/routes/email-verification.ts` (+0 -1) 📝 `packages/better-auth/src/db/with-hooks.ts` (+1 -0) </details> ### 📄 Description It's the same to using a custom `idGenerator`, except configurable by the database hook which would in theory provide more data. A use-case is to generate the id based on user info in the user before DB hook. Solves https://discord.com/channels/1288403910284935179/1379190465588367540/1384217435535835216 --- <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 11:52:59 -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#4622