[PR #5903] [CLOSED] feat(prisma): Enhance JSON default value handling for arrays and objects in schema generation #6309

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5903
Author: @rovertrack
Created: 11/11/2025
Status: Closed

Base: canaryHead: fix/jsondefaults


📝 Commits (1)

  • 73465b7 feat(prisma): Enhance JSON default value handling for arrays and objects in schema generation

📊 Changes

3 files changed (+103 additions, -2 deletions)

View changed files

📝 packages/cli/src/generators/prisma.ts (+62 -1)
📝 packages/cli/test/generate.test.ts (+39 -0)
📝 packages/core/src/db/type.ts (+2 -1)

📄 Description

solves #5900

Added objects and arrays compatibility for default JSON values with test cases

The default string value is not sorted for mysql ,but will be soon be done with the #5866 PR


Summary by cubic

Adds support for default JSON objects and arrays in Prisma schema generation, with proper escaping, plus defaults for string[] and number[]. Improves reliability of generated defaults and adds tests.

  • New Features
    • Support default values for JSON objects and arrays (escaped and quoted).
    • Generate defaults for string[] and number[], including empty arrays.
    • Skip string defaults on MySQL for now.
    • Add tests for JSON defaults and expand DBPrimitive to include Object.

Written for commit 73465b7220. 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/5903 **Author:** [@rovertrack](https://github.com/rovertrack) **Created:** 11/11/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/jsondefaults` --- ### 📝 Commits (1) - [`73465b7`](https://github.com/better-auth/better-auth/commit/73465b72206c6a738984db16a14711acfa1a1af2) feat(prisma): Enhance JSON default value handling for arrays and objects in schema generation ### 📊 Changes **3 files changed** (+103 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/generators/prisma.ts` (+62 -1) 📝 `packages/cli/test/generate.test.ts` (+39 -0) 📝 `packages/core/src/db/type.ts` (+2 -1) </details> ### 📄 Description **solves #5900** ### Added objects and arrays compatibility for default JSON values with test cases The default string value is not sorted for mysql ,but will be soon be done with the #5866 PR <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds support for default JSON objects and arrays in Prisma schema generation, with proper escaping, plus defaults for string[] and number[]. Improves reliability of generated defaults and adds tests. - **New Features** - Support default values for JSON objects and arrays (escaped and quoted). - Generate defaults for string[] and number[], including empty arrays. - Skip string defaults on MySQL for now. - Add tests for JSON defaults and expand DBPrimitive to include Object. <sup>Written for commit 73465b72206c6a738984db16a14711acfa1a1af2. 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 12:54:20 -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#6309