[PR #6432] [MERGED] refactor: replace DBPreservedModels with BaseModelNames #6664

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6432
Author: @Bekacru
Created: 11/30/2025
Status: Merged
Merged: 11/30/2025
Merged by: @Bekacru

Base: canaryHead: reafactor/models


📝 Commits (1)

  • 0ddfe1a refactor: replace DBPreservedModels with BaseModelNames

📊 Changes

5 files changed (+18 additions, -28 deletions)

View changed files

📝 packages/better-auth/src/db/with-hooks.ts (+6 -10)
📝 packages/core/src/db/index.ts (+2 -1)
📝 packages/core/src/db/type.ts (+6 -12)
📝 packages/core/src/types/context.ts (+2 -3)
📝 packages/core/src/types/init-options.ts (+2 -2)

📄 Description

Summary by cubic

Refactored model typing by replacing DBPreservedModels with BaseModelNames and introducing ModelNames for extensible model names. This clarifies the core model set and standardizes types across DB, hooks, and init options.

  • Refactors

    • Replace DBPreservedModels with BaseModelNames ("user" | "account" | "session" | "verification").
    • Add ModelNames = BaseModelNames | T | "rate-limit".
    • Update with-hooks, AuthContext, and GenerateIdFn to use the new types.
    • Export BaseModelNames and ModelNames from @better-auth/core/db.
  • Migration

    • Replace imports of DBPreservedModels with BaseModelNames or ModelNames.
    • Update generateId to accept model: ModelNames.
    • If you used additional model names, supply them via ModelNames<"your" | "names">.

Written for commit 0ddfe1a64d. 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/6432 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 11/30/2025 **Status:** ✅ Merged **Merged:** 11/30/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `reafactor/models` --- ### 📝 Commits (1) - [`0ddfe1a`](https://github.com/better-auth/better-auth/commit/0ddfe1a64deb8fa4e3ac747b67bb7ef1fb50cd25) refactor: replace DBPreservedModels with BaseModelNames ### 📊 Changes **5 files changed** (+18 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/with-hooks.ts` (+6 -10) 📝 `packages/core/src/db/index.ts` (+2 -1) 📝 `packages/core/src/db/type.ts` (+6 -12) 📝 `packages/core/src/types/context.ts` (+2 -3) 📝 `packages/core/src/types/init-options.ts` (+2 -2) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Refactored model typing by replacing DBPreservedModels with BaseModelNames and introducing ModelNames for extensible model names. This clarifies the core model set and standardizes types across DB, hooks, and init options. - **Refactors** - Replace DBPreservedModels with BaseModelNames ("user" | "account" | "session" | "verification"). - Add ModelNames<T> = BaseModelNames | T | "rate-limit". - Update with-hooks, AuthContext, and GenerateIdFn to use the new types. - Export BaseModelNames and ModelNames from @better-auth/core/db. - **Migration** - Replace imports of DBPreservedModels with BaseModelNames or ModelNames. - Update generateId to accept model: ModelNames. - If you used additional model names, supply them via ModelNames<"your" | "names">. <sup>Written for commit 0ddfe1a64deb8fa4e3ac747b67bb7ef1fb50cd25. 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:15 -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#6664