diff --git a/packages/auth-adapters/better-auth/src/schema-generator.ts b/packages/auth-adapters/better-auth/src/schema-generator.ts index e1a3ae78..ea7ac4e0 100644 --- a/packages/auth-adapters/better-auth/src/schema-generator.ts +++ b/packages/auth-adapters/better-auth/src/schema-generator.ts @@ -44,7 +44,7 @@ export async function generateSchema( } } - const schemaExists = !!(filePath && fs.existsSync(filePath)); + const schemaExists = fs.existsSync(filePath); const schema = await updateSchema(filePath, tables, config, options); @@ -161,22 +161,22 @@ function createDataModel(modelName: string, zmodel: Model, numericId: boolean) { } function addModelField(dataModel: DataModel, fieldName: string, fieldType: string, array: boolean, optional: boolean) { - const idField: DataField = { + const field: DataField = { $type: 'DataField', name: fieldName, attributes: [], comments: [], $container: dataModel, } as any; - idField.type = { + field.type = { $type: 'DataFieldType', type: fieldType as any, array, optional, - $container: idField, + $container: field, }; - dataModel.fields.push(idField); - return idField; + dataModel.fields.push(field); + return field; } function initializeZmodel(config: AdapterConfig) { @@ -340,7 +340,7 @@ function addOrUpdateModel( addDefaultNow(df); } else { console.warn( - `Warning: Unsupported default function for field ${fieldName} in model ${fName}. Please adjust manually.`, + `Warning: Unsupported default function for field ${fieldName} in model ${table.modelName}. Please adjust manually.`, ); } } diff --git a/packages/cli/src/actions/action-utils.ts b/packages/cli/src/actions/action-utils.ts index 8a0ca741..a96bdb89 100644 --- a/packages/cli/src/actions/action-utils.ts +++ b/packages/cli/src/actions/action-utils.ts @@ -36,7 +36,7 @@ export function getSchemaFile(file?: string) { return './zenstack/schema.zmodel'; } else { throw new CliError( - 'Schema file not found in default locations ("./zenstack/schema.zmodel" or "./schema.zmodel").', + 'Schema file not found in default locations ("./schema.zmodel" or "./zenstack/schema.zmodel").', ); } }