diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3b605..0edd8d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,23 @@ # Changelog +## 0.3.5 + +* moved to ts-node - you can now use this library installed directly from github repo +* support for UNSIGNED columns in MySQL (#179) +* support for richer derivation of column & entity name (#176) +* new option to generate code compliant with `strictPropertyInitialization` flag(#136, #182) +* new option to skip schema and database identifier in generated entities (#177) +* new option to specify request timeout (#185) +* added property visibility to RelationId properties (#167) +* disabled generating complex relationships(until #117 is fixed) +* fixed issue with setting precision when scale isn't default on numeric types (#184) +* PostgreSQL enum support (#187) +* generating access modifier to constructor (#169) +* fixed RelationId generation with different casing scenarios (#192) + ## 0.3.4 -* fixed using property case on uppercased columns(#157) +* fixed using property case on uppercase columns(#157) ## 0.3.3 @@ -15,16 +30,16 @@ * fixed problems with mysql 8 * fixed shadowed variables tslint errors(#141) * fixed order of generated columns -* mariadb default value comatibility changes(#153) +* mariadb default value compatibility changes(#153) ## 0.3.1 -* Fixed npx ussage(#146) +* Fixed npx usage(#146) # 0.3.0 * Wizard mode - you can now run model generation without passing any parameters and provide them step by step. It also allows you to save provided informations for future use * generated columns no longer contains options which are set by default in typeorm * added support for VARBINARY type on MySQL, MariaDb -* fixed issue with case convertion and @RetlationId fields +* fixed issue with case conversion and @RetlationId fields * a lot of internal work ## 0.2.25 @@ -42,8 +57,8 @@ * fixed some problems with duplicated relationships on mysql database ## 0.2.22 -* fixed naming stategy for guid ended column names -* fixed column names case convertion in index declarations +* fixed naming strategy for guid ended column names +* fixed column names case conversion in index declarations ## 0.2.21 * primary keys using identity/sequence are now generated with `@PrimaryGeneratedColumn` decorator [#96](https://github.com/Kononnable/typeorm-model-generator/issues/96) @@ -54,7 +69,7 @@ * upgraded typeorm version ## 0.2.19 -* custom naming strategy fiexes +* custom naming strategy fixes * dependencies update ## 0.2.18 diff --git a/README.md b/README.md index 2876c89..f7eb48d 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,13 @@ Thanks to npx you can use npm modules without polluting global installs. So noth ### Database drivers All database drivers except oracle are installed by default. To use typeorm-model-generator with oracle database you need to install driver with `npm i oracledb` and configure [oracle install client](http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html) on your machine. -## Usage +## Usage +There are two way to use this utility: +- Use step by step wizard which will guide you though the process - just type `npx typeorm-model-generator` in your console. +- Provide all parameters through command line(examples below) + +Use `npx typeorm-model-generator --help` to see all available parameters with their descriptions. Some basic parameters below: ```shell Usage: typeorm-model-generator -h -d -p [port] -u -x [password] -e [engine] @@ -42,26 +47,11 @@ Options: [choices: "mssql", "postgres", "mysql", "mariadb", "oracle", "sqlite"] [default: "mssql"] -o, --output Where to place generated models - [default: "Z:\Repos\typeorm-model-generator\output"] + [default: "./output"] -s, --schema Schema name to create model from. Only for mssql and postgres. You can pass multiple values separted by comma eg. -s scheme1,scheme2,scheme3 --ssl [boolean] [default: false] - --noConfig Doesn't create tsconfig.json and ormconfig.json - [boolean] [default: false] - --cf, --case-file Convert file names to specified case - [choices: "pascal", "param", "camel", "none"] [default: "none"] - --ce, --case-entity Convert class names to specified case - [choices: "pascal", "camel", "none"] [default: "none"] - --cp, --case-property Convert property names to specified case - [choices: "pascal", "camel", "none"] [default: "none"] - --lazy Generate lazy relations [boolean] [default: false] - -a, --active-record Generate models that use the ActiveRecord syntax - [boolean] [default: false] - --namingStrategy Use custom naming strategy - --relationIds Generate RelationId fields [boolean] [default: false] - --generateConstructor Generate constructor allowing partial initialization - [boolean] [default: false] ``` ### Examples diff --git a/src/drivers/AbstractDriver.ts b/src/drivers/AbstractDriver.ts index b7366a9..171444b 100644 --- a/src/drivers/AbstractDriver.ts +++ b/src/drivers/AbstractDriver.ts @@ -225,7 +225,8 @@ export default abstract class AbstractDriver { relationTmp.ownerColumnsNames.length * 2 ) { TomgUtils.LogError( - `Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.` + `Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.`, + false ); return; } @@ -237,7 +238,8 @@ export default abstract class AbstractDriver { )!; if (!secondRelation) { TomgUtils.LogError( - `Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.` + `Relation between tables ${relationTmp.ownerTable} and ${relationTmp.referencedTable} wasn't generated correctly - complex relationships aren't supported yet.`, + false ); return; } diff --git a/src/index.ts b/src/index.ts index 73fed22..e544ac9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,7 @@ function GetUtilParametersByArgs() { alias: "database", demand: true, describe: - "Database name(or path for sqlite). You can pass multiple values separted by comma." + "Database name(or path for sqlite). You can pass multiple values separated by comma." }) .option("u", { alias: "user", @@ -98,7 +98,7 @@ function GetUtilParametersByArgs() { .option("s", { alias: "schema", describe: - "Schema name to create model from. Only for mssql and postgres. You can pass multiple values separted by comma eg. -s scheme1,scheme2,scheme3" + "Schema name to create model from. Only for mssql and postgres. You can pass multiple values separated by comma eg. -s scheme1,scheme2,scheme3" }) .option("ssl", { boolean: true, @@ -267,14 +267,14 @@ async function GetUtilParametersByInquirer() { } }, { - message: "Database user pasword:", + message: "Database user password:", name: "password", type: "password" }, { default: "", message: - "Database name: (You can pass multiple values separted by comma)", + "Database name: (You can pass multiple values separated by comma)", name: "dbName", type: "input" } @@ -287,7 +287,7 @@ async function GetUtilParametersByInquirer() { { default: driver.standardSchema, message: - "Database schema: (You can pass multiple values separted by comma)", + "Database schema: (You can pass multiple values separated by comma)", name: "schema", type: "input" } @@ -390,7 +390,7 @@ async function GetUtilParametersByInquirer() { value: "namingConvention" } ], - message: "Avaliable customizations", + message: "Available customizations", name: "selected", type: "checkbox" } @@ -434,7 +434,7 @@ async function GetUtilParametersByInquirer() { const namingStrategyPath = ((await inquirer.prompt([ { default: path.resolve(process.cwd()), - message: "Path to custom naming stategy file:", + message: "Path to custom naming strategy file:", name: "namingStrategy", type: "input", validate(value) {