[PR #5092] [MERGED] refactor: move BetterAuthPluginDBSchema to core #22670

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

📋 Pull Request Information

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

Base: canaryHead: himself65/2025/10/04/refactor-db-schema


📝 Commits (4)

📊 Changes

19 files changed (+72 additions, -70 deletions)

View changed files

📝 packages/better-auth/src/db/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/admin/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/anonymous/index.ts (+2 -2)
📝 packages/better-auth/src/plugins/api-key/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/device-authorization/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/jwt/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/oidc-provider/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/organization/organization.ts (+5 -5)
📝 packages/better-auth/src/plugins/passkey/index.ts (+3 -6)
📝 packages/better-auth/src/plugins/phone-number/index.ts (+3 -6)
📝 packages/better-auth/src/plugins/siwe/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/two-factor/schema.ts (+2 -2)
📝 packages/better-auth/src/plugins/username/schema.ts (+2 -2)
📝 packages/better-auth/src/types/plugins.ts (+12 -24)
📝 packages/core/src/db/index.ts (+6 -0)
packages/core/src/db/plugin.ts (+11 -0)
📝 packages/stripe/package.json (+2 -0)
📝 packages/stripe/src/schema.ts (+3 -3)
📝 pnpm-lock.yaml (+7 -6)

📄 Description

Summary by cubic

Moves the plugin DB schema type into @better-auth/core to standardize schema typing and simplify imports. All plugins now use BetterAuthPluginDBSchema, with a temporary alias for backward compatibility.

  • Refactors

    • Added core/db/plugin.ts exporting BetterAuthPluginDBSchema and re-export in core/db/index.ts.
    • Replaced all AuthPluginSchema imports with BetterAuthPluginDBSchema across plugins and stripe.
    • Updated mergeSchema and InferOptionSchema to use the new type.
    • Added deprecated alias AuthPluginSchema in core (to be removed in 1.4.x).
  • Migration

    • Plugin authors: import type { BetterAuthPluginDBSchema } from "@better-auth/core/db".
    • Temporary option: import type { AuthPluginSchema } from "@better-auth/core/db" (deprecated).
    • No runtime changes or DB migrations required.

🔄 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/5092 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/5/2025 **Status:** ✅ Merged **Merged:** 10/5/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/04/refactor-db-schema` --- ### 📝 Commits (4) - [`49e2092`](https://github.com/better-auth/better-auth/commit/49e2092e58a2adcc2b9fadb0899f34d92bcd2a95) refactor: move `BetterAuthPluginDBSchema` to core - [`afe2bd4`](https://github.com/better-auth/better-auth/commit/afe2bd48265b84ee2e57333ed2654079adfbdbd0) fix: import - [`d1b08f0`](https://github.com/better-auth/better-auth/commit/d1b08f070d05a9292c300d04bed3b916cde69eca) chore: dep fix - [`8d62cf6`](https://github.com/better-auth/better-auth/commit/8d62cf61ffce8c2de09e667b2da4248009382bc9) fix: import ### 📊 Changes **19 files changed** (+72 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/admin/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/anonymous/index.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/api-key/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/device-authorization/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/jwt/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/oidc-provider/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+5 -5) 📝 `packages/better-auth/src/plugins/passkey/index.ts` (+3 -6) 📝 `packages/better-auth/src/plugins/phone-number/index.ts` (+3 -6) 📝 `packages/better-auth/src/plugins/siwe/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/two-factor/schema.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/username/schema.ts` (+2 -2) 📝 `packages/better-auth/src/types/plugins.ts` (+12 -24) 📝 `packages/core/src/db/index.ts` (+6 -0) ➕ `packages/core/src/db/plugin.ts` (+11 -0) 📝 `packages/stripe/package.json` (+2 -0) 📝 `packages/stripe/src/schema.ts` (+3 -3) 📝 `pnpm-lock.yaml` (+7 -6) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Moves the plugin DB schema type into @better-auth/core to standardize schema typing and simplify imports. All plugins now use BetterAuthPluginDBSchema, with a temporary alias for backward compatibility. - **Refactors** - Added core/db/plugin.ts exporting BetterAuthPluginDBSchema and re-export in core/db/index.ts. - Replaced all AuthPluginSchema imports with BetterAuthPluginDBSchema across plugins and stripe. - Updated mergeSchema and InferOptionSchema to use the new type. - Added deprecated alias AuthPluginSchema in core (to be removed in 1.4.x). - **Migration** - Plugin authors: import type { BetterAuthPluginDBSchema } from "@better-auth/core/db". - Temporary option: import type { AuthPluginSchema } from "@better-auth/core/db" (deprecated). - No runtime changes or DB migrations required. <!-- 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:12:26 -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#22670