mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
chore: minor fixes (#421)
This commit is contained in:
parent
fcd557312d
commit
710cb8bb36
2 changed files with 8 additions and 8 deletions
|
|
@ -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.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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").',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue