[PR #5515] [MERGED] feat(organization): refactor organization schema to use BetterAuth types #22955

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

📋 Pull Request Information

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

Base: canaryHead: himself65/2025/10/22/org


📝 Commits (2)

  • ab9d207 feat(organization): refactor organization schema to use BetterAuth types
  • 5fb026a chore: type fix

📊 Changes

2 files changed (+254 additions, -496 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/schema.ts (+253 -495)
📝 packages/core/src/db/plugin.ts (+1 -1)

📄 Description

Summary by cubic

Refactored the organization plugin schema to use BetterAuth core DB types with a new InferSchema helper. This reduces boilerplate, improves type safety, and keeps plugin schemas consistent with the core DB.

  • Refactors
    • Added BetterAuthPluginDBSchemaFields and updated BetterAuthPluginDBSchema to use string-indexed fields.
    • Rewrote organization, member, invitation, team, teamMember, and session schema types to infer modelName and fields from the plugin schema.
    • Removed duplicated field definitions and custom fieldName plumbing.
    • Preserves dynamicAccessControl and teams support (including teamId on invitations and activeTeamId in session when teams are enabled).

🔄 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/5515 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/23/2025 **Status:** ✅ Merged **Merged:** 10/23/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/22/org` --- ### 📝 Commits (2) - [`ab9d207`](https://github.com/better-auth/better-auth/commit/ab9d207ba1b1aeab9208aa8db7a571628670bccf) feat(organization): refactor organization schema to use BetterAuth types - [`5fb026a`](https://github.com/better-auth/better-auth/commit/5fb026a57a75c11bae1e6f9c9cdaa41102393ede) chore: type fix ### 📊 Changes **2 files changed** (+254 additions, -496 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/schema.ts` (+253 -495) 📝 `packages/core/src/db/plugin.ts` (+1 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Refactored the organization plugin schema to use BetterAuth core DB types with a new InferSchema helper. This reduces boilerplate, improves type safety, and keeps plugin schemas consistent with the core DB. - **Refactors** - Added BetterAuthPluginDBSchemaFields and updated BetterAuthPluginDBSchema to use string-indexed fields. - Rewrote organization, member, invitation, team, teamMember, and session schema types to infer modelName and fields from the plugin schema. - Removed duplicated field definitions and custom fieldName plumbing. - Preserves dynamicAccessControl and teams support (including teamId on invitations and activeTeamId in session when teams are enabled). <!-- 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:23:23 -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#22955