[PR #4374] [MERGED] fix: add missing defaultValue on core schema #30942

Closed
opened 2026-04-17 21:55:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: canaryHead: himself65/2025/09/02/get-tables


📝 Commits (2)

  • 6e22fcc fix: add missing defaultValue on core schema
  • dd199f1 fix: default value

📊 Changes

13 files changed (+52 additions, -24 deletions)

View changed files

📝 packages/better-auth/src/__snapshots__/init.test.ts.snap (+2 -0)
📝 packages/better-auth/src/db/get-tables.ts (+4 -2)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-number-id.txt (+6 -2)
📝 packages/cli/test/__snapshots__/auth-schema-mysql.txt (+6 -2)
📝 packages/cli/test/__snapshots__/auth-schema-number-id.txt (+6 -2)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt (+6 -2)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite.txt (+6 -2)
📝 packages/cli/test/__snapshots__/auth-schema.txt (+6 -2)
📝 packages/cli/test/__snapshots__/schema-mongodb.prisma (+2 -2)
📝 packages/cli/test/__snapshots__/schema-mysql-custom.prisma (+2 -2)
📝 packages/cli/test/__snapshots__/schema-mysql.prisma (+2 -2)
📝 packages/cli/test/__snapshots__/schema-numberid.prisma (+2 -2)
📝 packages/cli/test/__snapshots__/schema.prisma (+2 -2)

📄 Description

Summary by cubic

Add missing default timestamps and make plugin schema building safe. This ensures createdAt is set automatically and avoids errors when no plugins are provided.

  • Bug Fixes
    • Set defaultValue: () => new Date() for session.createdAt and account.createdAt.
    • Use (options.plugins ?? []).reduce(...) and remove fallback destructuring to prevent undefined errors.

🔄 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/4374 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/2/2025 **Status:** ✅ Merged **Merged:** 9/3/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/02/get-tables` --- ### 📝 Commits (2) - [`6e22fcc`](https://github.com/better-auth/better-auth/commit/6e22fcc1b96480200159afea1743ab1504d8204e) fix: add missing defaultValue on core schema - [`dd199f1`](https://github.com/better-auth/better-auth/commit/dd199f11ef563c38386c5b82c7809e5b371b809b) fix: default value ### 📊 Changes **13 files changed** (+52 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/__snapshots__/init.test.ts.snap` (+2 -0) 📝 `packages/better-auth/src/db/get-tables.ts` (+4 -2) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-number-id.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/auth-schema-number-id.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/auth-schema.txt` (+6 -2) 📝 `packages/cli/test/__snapshots__/schema-mongodb.prisma` (+2 -2) 📝 `packages/cli/test/__snapshots__/schema-mysql-custom.prisma` (+2 -2) 📝 `packages/cli/test/__snapshots__/schema-mysql.prisma` (+2 -2) 📝 `packages/cli/test/__snapshots__/schema-numberid.prisma` (+2 -2) 📝 `packages/cli/test/__snapshots__/schema.prisma` (+2 -2) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Add missing default timestamps and make plugin schema building safe. This ensures createdAt is set automatically and avoids errors when no plugins are provided. - **Bug Fixes** - Set defaultValue: () => new Date() for session.createdAt and account.createdAt. - Use (options.plugins ?? []).reduce(...) and remove fallback destructuring to prevent undefined errors. <!-- 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-17 21:55:21 -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#30942