feat(drizzle): generate drizzle schema with schema namespace#7169
Open
ping-maxwell wants to merge 11 commits intobetter-auth:mainfrom
Open
feat(drizzle): generate drizzle schema with schema namespace#7169ping-maxwell wants to merge 11 commits intobetter-auth:mainfrom
ping-maxwell wants to merge 11 commits intobetter-auth:mainfrom
Conversation
|
@ping-maxwell is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
better-auth
@better-auth/cli
@better-auth/core
@better-auth/expo
@better-auth/mcp
@better-auth/oauth-provider
@better-auth/passkey
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
commit: |
Contributor
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/cli/src/generators/drizzle.ts">
<violation number="1" location="packages/cli/src/generators/drizzle.ts:26">
P1: The leading number handling is ineffective. The underscore added by `.replace(/^[0-9]/, "_$&")` will be removed by the subsequent `.replace(/_/g, "")`, resulting in invalid JavaScript identifiers for schema names starting with numbers (e.g., `"123schema"` → `"123schema"` instead of `"_123schema"`).
Reorder operations: remove underscores first (for camelCase), then handle leading numbers.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
himself65
approved these changes
Jan 8, 2026
|
Would it be possible to pass an existing pgSchema to the config instead of just a string?
I think most use cases are from apps that already use a pgSchema across the app and want to reuse it for the auth. For this cases this implementation would not be usable. |
85f5056 to
5de9704
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #6606
Docs
Custom Schema namespace
If you're using PostgreSQL and you want to generate the schema with a custom schema namespace,
you can pass the
schemaNameoption to the Drizzle adapter.Then when using the Better Auth CLI, it will generate the schema that looks something like this:
Summary by cubic
Add schemaName support to the Drizzle adapter so the CLI can generate PostgreSQL schemas under a custom namespace. MySQL and SQLite remain unchanged.
New Features
Migration
Written for commit 47c7b2e. Summary will update on new commits.