Merge pull request #259 from drsugiaichigo00781vn/continue-when-generate-error

ignore table have numberic column name
This commit is contained in:
Kononnable 2020-03-19 18:30:19 +01:00 committed by GitHub
commit c7d768cca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,9 +80,19 @@ function generateModels(
)
: rendered
);
const formatted = Prettier.format(withImportStatements, {
parser: "typescript"
});
let formatted = "";
try {
formatted = Prettier.format(withImportStatements, {
parser: "typescript"
});
} catch (error) {
console.error(
"There were some problems with model generation for table: ",
element.sqlName
);
console.error(error);
formatted = withImportStatements;
}
fs.writeFileSync(resultFilePath, formatted, {
encoding: "UTF-8",
flag: "w"