@better-auth/cli 1.3.0-beta.9 → 1.3.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +12 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -398,7 +398,10 @@ const migrate = new Command("migrate").option(
|
|
|
398
398
|
false
|
|
399
399
|
).action(migrateAction);
|
|
400
400
|
|
|
401
|
-
function convertToSnakeCase(str) {
|
|
401
|
+
function convertToSnakeCase(str, camelCase) {
|
|
402
|
+
if (camelCase) {
|
|
403
|
+
return str;
|
|
404
|
+
}
|
|
402
405
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
403
406
|
}
|
|
404
407
|
const generateDrizzleSchema = async ({
|
|
@@ -423,7 +426,7 @@ const generateDrizzleSchema = async ({
|
|
|
423
426
|
`Database provider type is undefined during Drizzle schema generation. Please define a \`provider\` in the Drizzle adapter config. Read more at https://better-auth.com/docs/adapters/drizzle`
|
|
424
427
|
);
|
|
425
428
|
}
|
|
426
|
-
name = convertToSnakeCase(name);
|
|
429
|
+
name = convertToSnakeCase(name, adapter.options?.camelCase);
|
|
427
430
|
if (field.references?.field === "id") {
|
|
428
431
|
if (options.advanced?.database?.useNumberId) {
|
|
429
432
|
if (databaseType === "pg") {
|
|
@@ -434,6 +437,11 @@ const generateDrizzleSchema = async ({
|
|
|
434
437
|
return `integer('${name}')`;
|
|
435
438
|
}
|
|
436
439
|
}
|
|
440
|
+
if (field.references.field) {
|
|
441
|
+
if (databaseType === "mysql") {
|
|
442
|
+
return `varchar('${name}', { length: 36 })`;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
437
445
|
return `text('${name}')`;
|
|
438
446
|
}
|
|
439
447
|
const type = field.type;
|
|
@@ -491,7 +499,8 @@ const generateDrizzleSchema = async ({
|
|
|
491
499
|
}
|
|
492
500
|
}
|
|
493
501
|
const schema = `export const ${modelName} = ${databaseType}Table("${convertToSnakeCase(
|
|
494
|
-
modelName
|
|
502
|
+
modelName,
|
|
503
|
+
adapter.options?.camelCase
|
|
495
504
|
)}", {
|
|
496
505
|
id: ${id},
|
|
497
506
|
${Object.keys(fields).map((field) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1-beta.1",
|
|
4
4
|
"description": "The CLI for Better Auth",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tinyexec": "^0.3.1",
|
|
56
56
|
"yocto-spinner": "^0.1.1",
|
|
57
57
|
"zod": "^3.23.8",
|
|
58
|
-
"better-auth": "1.3.
|
|
58
|
+
"better-auth": "1.3.1-beta.1"
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
|
61
61
|
"dist"
|