[PR #5048] [MERGED] refactor: move schemas to core #5737

Closed
opened 2026-03-13 12:33:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5048
Author: @himself65
Created: 10/2/2025
Status: Merged
Merged: 10/2/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/02/refactor-user-schema


📝 Commits (4)

  • 96a6830 refactor: move user schema to core
  • 75e8e31 refactor: move account schema to core
  • 927d012 refactor: move session schema to core
  • 3e915d7 refactor: move verification schema to core

📊 Changes

9 files changed (+102 additions, -65 deletions)

View changed files

📝 packages/better-auth/src/adapters/adapter-factory/index.ts (+0 -1)
📝 packages/better-auth/src/db/schema.ts (+0 -53)
📝 packages/better-auth/src/types/models.ts (+7 -11)
📝 packages/core/src/db/index.ts (+6 -0)
packages/core/src/db/schema/account.ts (+34 -0)
packages/core/src/db/schema/session.ts (+17 -0)
packages/core/src/db/schema/shared.ts (+7 -0)
packages/core/src/db/schema/user.ts (+16 -0)
packages/core/src/db/schema/verification.ts (+15 -0)

📄 Description

Summary by cubic

Moved user, account, session, and verification schemas (and their types) into @better-auth/core to centralize and share them across packages. Updated better-auth to use these core exports and removed duplicate local schemas.

  • Refactors

    • Added Zod schemas under packages/core/src/db/schema and exported them from @better-auth/core/db.
    • Removed schemas from packages/better-auth and switched model types to import from core.
    • Deleted an unused parseUserInput import.
  • Migration

    • Update imports to use @better-auth/core/db for userSchema, accountSchema, sessionSchema, verificationSchema, and User/Account/Session/Verification.
    • No API or behavior changes; only import paths change.

🔄 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/5048 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/02/refactor-user-schema` --- ### 📝 Commits (4) - [`96a6830`](https://github.com/better-auth/better-auth/commit/96a68304c10386cb9bd7b6a41b0478df8b6514eb) refactor: move user schema to core - [`75e8e31`](https://github.com/better-auth/better-auth/commit/75e8e313863583a96c0f9201d6d2c7599ffe9233) refactor: move account schema to core - [`927d012`](https://github.com/better-auth/better-auth/commit/927d0123dbc974a290aaa8eba1f48b734e0ed7c4) refactor: move session schema to core - [`3e915d7`](https://github.com/better-auth/better-auth/commit/3e915d774975db7afc92ae0228bcfcc84e0a2f37) refactor: move verification schema to core ### 📊 Changes **9 files changed** (+102 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/adapter-factory/index.ts` (+0 -1) 📝 `packages/better-auth/src/db/schema.ts` (+0 -53) 📝 `packages/better-auth/src/types/models.ts` (+7 -11) 📝 `packages/core/src/db/index.ts` (+6 -0) ➕ `packages/core/src/db/schema/account.ts` (+34 -0) ➕ `packages/core/src/db/schema/session.ts` (+17 -0) ➕ `packages/core/src/db/schema/shared.ts` (+7 -0) ➕ `packages/core/src/db/schema/user.ts` (+16 -0) ➕ `packages/core/src/db/schema/verification.ts` (+15 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Moved user, account, session, and verification schemas (and their types) into @better-auth/core to centralize and share them across packages. Updated better-auth to use these core exports and removed duplicate local schemas. - **Refactors** - Added Zod schemas under packages/core/src/db/schema and exported them from @better-auth/core/db. - Removed schemas from packages/better-auth and switched model types to import from core. - Deleted an unused parseUserInput import. - **Migration** - Update imports to use @better-auth/core/db for userSchema, accountSchema, sessionSchema, verificationSchema, and User/Account/Session/Verification. - No API or behavior changes; only import paths change. <!-- 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 12:33:29 -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#5737