disable snake case in drizzle orm generator #1000

Closed
opened 2026-03-13 08:16:41 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @bil0ak on GitHub (Apr 8, 2025).

Is this suited for github?

  • Yes, this is suited for github

My schema in drizzle is not using snake case, but the auth generator has a default of snake case with no option to pass my own parameter.
Sure i can just specify all the name manually but that is honestly unreasonable.

Describe the solution you'd like

we need a parameter that can be passed in the drizzleAdapter config to set our preference.

Describe alternatives you've considered

I created a patch to return the name as is.

diff --git a/dist/index.mjs b/dist/index.mjs
index ac8f0c1a7b5b8f883819e49735a4887c7b40e31a..691959c30f29a9eb499027cb37ca380118552887 100755
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -394,7 +394,8 @@ const migrate = new Command("migrate").option(
 ).action(migrateAction);
 
 function convertToSnakeCase(str) {
-  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
+  // return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
+  return str
 }
 const generateDrizzleSchema = async ({
   options,

Additional context

No response

Originally created by @bil0ak on GitHub (Apr 8, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. My schema in drizzle is not using snake case, but the auth generator has a default of snake case with no option to pass my own parameter. Sure i can just specify all the name manually but that is honestly unreasonable. ### Describe the solution you'd like we need a parameter that can be passed in the drizzleAdapter config to set our preference. ### Describe alternatives you've considered I created a patch to return the name as is. ```typescript diff --git a/dist/index.mjs b/dist/index.mjs index ac8f0c1a7b5b8f883819e49735a4887c7b40e31a..691959c30f29a9eb499027cb37ca380118552887 100755 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -394,7 +394,8 @@ const migrate = new Command("migrate").option( ).action(migrateAction); function convertToSnakeCase(str) { - return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); + // return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); + return str } const generateDrizzleSchema = async ({ options, ``` ### Additional context _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1000