[PR #4494] [MERGED] fix(cli): add missing JSON type to schema generation #31011

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4494
Author: @TheGB0077
Created: 9/7/2025
Status: Merged
Merged: 9/14/2025
Merged by: @Bekacru

Base: canaryHead: update-json-definitions


📝 Commits (6)

  • f01ceb3 feat(cli): add json to schema-gen
  • 6097ce6 refactor(test): move tests to generalized test suite
  • 12c9bbb fix: add json type to imports
  • 89a0575 Merge branch 'canary' into update-json-definitions
  • 7575ac3 Merge branch 'better-auth:canary' into update-json-definitions
  • f7a6a8a Merge branch 'better-auth:canary' into update-json-definitions

📊 Changes

4 files changed (+122 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/db/get-migration.ts (+1 -1)
📝 packages/cli/src/generators/drizzle.ts (+23 -3)
📝 packages/cli/src/generators/prisma.ts (+3 -0)
📝 packages/cli/test/generate.test.ts (+95 -0)

📄 Description

PR #4297 Added support for JSON type to supported fields, but the cli did not receive the same updates. In addition, I replaced JSON to JSONb as it the preferred option in the context of pg databases.


Summary by cubic

Adds JSON field support to the CLI schema generators and switches PostgreSQL to JSONB in migrations. This aligns the CLI with core JSON support introduced in #4297.

  • New Features
    • Drizzle mapping: sqlite -> text, postgres -> jsonb, mysql -> json.
    • Prisma mapping: Json/Json? based on optionality.
    • Migration generator now outputs jsonb for postgres.
    • Tests added for pg, mysql, sqlite, and Prisma.

🔄 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/4494 **Author:** [@TheGB0077](https://github.com/TheGB0077) **Created:** 9/7/2025 **Status:** ✅ Merged **Merged:** 9/14/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `update-json-definitions` --- ### 📝 Commits (6) - [`f01ceb3`](https://github.com/better-auth/better-auth/commit/f01ceb308d5c754df64205bacd35e045d8fa1f25) feat(cli): add json to schema-gen - [`6097ce6`](https://github.com/better-auth/better-auth/commit/6097ce6a8c81eed87e4ddc7e6f9c8e4006879647) refactor(test): move tests to generalized test suite - [`12c9bbb`](https://github.com/better-auth/better-auth/commit/12c9bbbae2cea230e9895ec25df54a919dc8c542) fix: add json type to imports - [`89a0575`](https://github.com/better-auth/better-auth/commit/89a05756265182e4d2d2f3cdd9ce57e65bb3cbf4) Merge branch 'canary' into update-json-definitions - [`7575ac3`](https://github.com/better-auth/better-auth/commit/7575ac3fdbc92d708a92f6d4c408683ced82b558) Merge branch 'better-auth:canary' into update-json-definitions - [`f7a6a8a`](https://github.com/better-auth/better-auth/commit/f7a6a8ad9dd32a215f24a08f7e69a655d67f3fdb) Merge branch 'better-auth:canary' into update-json-definitions ### 📊 Changes **4 files changed** (+122 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/get-migration.ts` (+1 -1) 📝 `packages/cli/src/generators/drizzle.ts` (+23 -3) 📝 `packages/cli/src/generators/prisma.ts` (+3 -0) 📝 `packages/cli/test/generate.test.ts` (+95 -0) </details> ### 📄 Description PR #4297 Added support for JSON type to supported fields, but the cli did not receive the same updates. In addition, I replaced JSON to JSONb as it the preferred option in the context of pg databases. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds JSON field support to the CLI schema generators and switches PostgreSQL to JSONB in migrations. This aligns the CLI with core JSON support introduced in #4297. - **New Features** - Drizzle mapping: sqlite -> text, postgres -> jsonb, mysql -> json. - Prisma mapping: Json/Json? based on optionality. - Migration generator now outputs jsonb for postgres. - Tests added for pg, mysql, sqlite, and Prisma. <!-- 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:58:08 -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#31011