[PR #5287] [MERGED] feat: enum support for drizzle schema #31505

Closed
opened 2026-04-17 22:24:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: canaryHead: himself65/2025/10/13/enum


📝 Commits (1)

  • 38567d0 feat: enum support for drizzle schema

📊 Changes

5 files changed (+413 additions, -7 deletions)

View changed files

📝 packages/cli/src/generators/drizzle.ts (+37 -7)
packages/cli/test/__snapshots__/auth-schema-mysql-enum.txt (+69 -0)
packages/cli/test/__snapshots__/auth-schema-pg-enum.txt (+62 -0)
packages/cli/test/__snapshots__/auth-schema-sqlite-enum.txt (+77 -0)
📝 packages/cli/test/generate.test.ts (+168 -0)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/5268


Summary by cubic

Adds enum support to the Drizzle schema generator. Array-of-string field types now produce proper enum columns for Postgres, MySQL, and SQLite, fixing better-auth #5268.

  • New Features
    • Map array-of-strings to enums: pg -> pgEnum("name", [...]), mysql -> mysqlEnum([...]), sqlite -> text({ enum: [...] }).
    • Add pgEnum/mysqlEnum imports only when enums are present.
    • Throw a TypeError for invalid enum configs.
    • Add tests and snapshots for PG, MySQL, and SQLite.

🔄 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/5287 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/13/2025 **Status:** ✅ Merged **Merged:** 10/14/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/13/enum` --- ### 📝 Commits (1) - [`38567d0`](https://github.com/better-auth/better-auth/commit/38567d0b25caed8e70ff0b0b94d0abdcdc75443f) feat: enum support for drizzle schema ### 📊 Changes **5 files changed** (+413 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/generators/drizzle.ts` (+37 -7) ➕ `packages/cli/test/__snapshots__/auth-schema-mysql-enum.txt` (+69 -0) ➕ `packages/cli/test/__snapshots__/auth-schema-pg-enum.txt` (+62 -0) ➕ `packages/cli/test/__snapshots__/auth-schema-sqlite-enum.txt` (+77 -0) 📝 `packages/cli/test/generate.test.ts` (+168 -0) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/5268 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds enum support to the Drizzle schema generator. Array-of-string field types now produce proper enum columns for Postgres, MySQL, and SQLite, fixing better-auth #5268. - **New Features** - Map array-of-strings to enums: pg -> pgEnum("name", [...]), mysql -> mysqlEnum([...]), sqlite -> text({ enum: [...] }). - Add pgEnum/mysqlEnum imports only when enums are present. - Throw a TypeError for invalid enum configs. - Add tests and snapshots for PG, MySQL, and SQLite. <!-- 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 22:24:10 -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#31505