From 4d1a52a28af0b43de76f506c0c15240752575f8b Mon Sep 17 00:00:00 2001 From: Kononnable Date: Sat, 20 Jan 2018 01:24:15 +0100 Subject: [PATCH] fixing generated ormconfig.json(updating to newer typeorm) --- src/Engine.ts | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/src/Engine.ts b/src/Engine.ts index f028c36..930efbd 100644 --- a/src/Engine.ts +++ b/src/Engine.ts @@ -91,22 +91,22 @@ export class Engine { return retStr; }); Handlebars.registerHelper("toFileName", str => { - let retStr = '' - switch (this.Options.convertCaseFile) { - case 'camel': - retStr = changeCase.camelCase(str); - break; - case 'param': - retStr = changeCase.paramCase(str); - break; - case 'pascal': - retStr = changeCase.pascalCase(str); - break; - case 'none': - retStr = str; - break; - } - return retStr; + let retStr = '' + switch (this.Options.convertCaseFile) { + case 'camel': + retStr = changeCase.camelCase(str); + break; + case 'param': + retStr = changeCase.paramCase(str); + break; + case 'pascal': + retStr = changeCase.pascalCase(str); + break; + case 'none': + retStr = str; + break; + } + return retStr; }); Handlebars.registerHelper("toPropertyName", str => { let retStr = '' @@ -145,14 +145,13 @@ export class Engine { fs.writeFileSync(path.resolve(resultPath, 'ormconfig.json'), `[ { "name": "default", - "driver": { - "type": "${this.Options.databaseType}", - "host": "${this.Options.host}", - "port": ${this.Options.port}, - "username": "${this.Options.user}", - "password": "${this.Options.password}", - "database": "${this.Options.databaseName}" - }, + "type": "${this.Options.databaseType}", + "host": "${this.Options.host}", + "port": ${this.Options.port}, + "username": "${this.Options.user}", + "password": "${this.Options.password}", + "database": "${this.Options.databaseName}", + "synchronize": false "entities": [ "entities/*.js" ] @@ -163,15 +162,14 @@ export class Engine { fs.writeFileSync(path.resolve(resultPath, 'ormconfig.json'), `[ { "name": "default", - "driver": { - "type": "${this.Options.databaseType}", - "host": "${this.Options.host}", - "port": ${this.Options.port}, - "username": "${this.Options.user}", - "password": "${this.Options.password}", - "database": "${this.Options.databaseName}", - "schema": "${this.Options.schemaName}" - }, + "type": "${this.Options.databaseType}", + "host": "${this.Options.host}", + "port": ${this.Options.port}, + "username": "${this.Options.user}", + "password": "${this.Options.password}", + "database": "${this.Options.databaseName}", + "schema": "${this.Options.schemaName}", + "synchronize": false, "entities": [ "entities/*.js" ]