Go to file
2018-05-05 22:26:52 +02:00
bin readme, preparation to npm publish 2017-07-20 23:16:55 +02:00
src SQLite column recognition fix 2018-05-05 22:26:52 +02:00
test longer timeouts on tests 2018-05-05 21:14:52 +02:00
.editorconfig Added editorconfig 2017-12-30 16:04:10 +01:00
.gitignore gulp tasks 2018-03-18 20:06:46 +01:00
.npmignore added some files to .npmignore 2018-03-18 22:40:16 +01:00
.prettierrc added prettier 2018-02-04 23:38:43 +01:00
.travis.yml fixing travis build 2018-05-03 21:14:23 +02:00
codecov.yml CI builds for Oracle 2018-04-23 22:41:46 +02:00
docker-compose-without-login.yml CI builds for Oracle 2018-04-23 22:41:46 +02:00
docker-compose.yml CI builds for Oracle 2018-04-23 22:41:46 +02:00
gulpfile.js CI builds for Oracle 2018-04-23 22:41:46 +02:00
LICENSE Initial commit 2017-03-23 20:52:39 +01:00
package-lock.json chore(package): update lockfile 2018-05-01 14:16:27 +00:00
package.json chore(package): update fs-extra to version 6.0.0 2018-05-01 14:06:05 +00:00
README.md console parameters changes for sqlite 2018-05-05 22:09:03 +02:00
tsconfig.json OracleDB support #9 2018-04-15 18:13:33 +02:00
typings.json Formatting existing code 2017-12-31 17:28:41 +01:00

typeorm-model-generator

Greenkeeper badge Build Status npm version codecov

Generates models for TypeORM from existing databases. Suported db engines:

  • Microsoft SQL Server
  • PostgreSQL
  • MySQL
  • MariaDB
  • Oracle Database
  • SQLite

Installation

Global module

To install module globally simply type npm i -g typeorm-model-generator in your console.

Npx way

Thanks to npx you can use npm modules without polluting global installs. So nothing to do here :)

To use npx you need to use npm at version at least 5.2.0. Try updating your npm by npm i -g npm

Usage

Usage: typeorm-model-generator -h <host> -d <database> -p [port] -u <user> -x
[password] -e [engine]

Options:
  --help                 Show help                                     [boolean]
  --version              Show version number                           [boolean]
  -h, --host             IP adress/Hostname for database server
                                                          [default: "127.0.0.1"]
  -d, --database         Database name(or path for sqlite)            [required]
  -u, --user             Username for database server
  -x, --pass             Password for database server              [default: ""]
  -p, --port             Port number for database server
  -e, --engine           Database engine
          [choices: "mssql", "postgres", "mysql", "mariadb", "oracle", "sqlite"]
                                                              [default: "mssql"]
  -o, --output           Where to place generated models
                            [default: "Z:\Repos\typeorm-model-generator\output"]
  -s, --schema           Schema name to create model from. Only for mssql and
                         postgres
  --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]
  --generateConstructor  Generate constructor allowing partial initialization
                                                      [boolean] [default: false]

Examples

  • Creating model from local MSSQL database
    • Global module
      typeorm-model-generator -h localhost -d tempdb -u sa -x !Passw0rd -e mssql -o .
      
    • Npx Way
      npx typeorm-model-generator -h localhost -d tempdb -u sa -x !Passw0rd -e mssql -o .
      
  • Creating model from local Postgres database, public schema with ssl connection
    • Global module
      typeorm-model-generator -h localhost -d postgres -u postgres -x !Passw0rd -e postgres -o . -s public --ssl
      
    • Npx Way
      npx typeorm-model-generator -h localhost -d postgres -u postgres -x !Passw0rd -e postgres -o . -s public --ssl
      
  • Creating model from SQLite database
    • Global module
      typeorm-model-generator -d "Z:\sqlite.db" -e sqlite -o .
      
    • Npx Way
      npx typeorm-model-generator -d "Z:\sqlite.db" -e sqlite -o .