@itemku/typeorm-code-generator
v0.1.0
Published
From SQL Statement to typeorm migration code in typescript
Downloads
2
Keywords
Readme
Fivejack / Typeorm Migration Code Generator
This CLI program helps generate code segment used in typeorm migration typescript code. The input is MySql DDL in MySql Workbench or SQL statements in general.
Basic dependencies
Make sure you have these installed in your computer for development
- Node.js
- Yarn (or npm)
- Nodemon (
yarn global add nodemon
ornpm install -g nodemon
)
How to Install
- yarn build (if you clone the project and want to build locally)
- npm install -g @itemku/typeorm-code-generator
How to Generate Migration Code
run in git bash terminal: 'typeorm-generate migration:create -i <input_sql_file> -n <migration_name>' example: typeorm-generate migration:create -i shop.sql -n create-shop-table
You should already have database/migrations folder, and it will generate -create-shop-table.ts
How to Generate Columns Code Segment
run in git bash terminal: 'typeorm-generate migration:column -i <input_sql_file> -o <output_file>' example: typeorm-generate migration:column -i shop.sql -o columns.ts
This is for generating columns code segment only.
How to Generate Indices Code Segment
run in git bash terminal: 'typeorm-generate migration:index -i <input_sql_file> -o <output_file>' example: typeorm-generate migration:index -i shop.sql -o indices.ts
This is for generating indices code segment only.