$ npm install
NOTE: If this application is run inside docker then these script should be run inside docker container shell (exec sh) since we need env variable
All migrations file generated will be in src/database-config/migrations
Change NODE_ENV to production before running migration manually
Generate an ormconfig.json
so we can use typeorm cli to run migration commands.
Only need to run this step once to generate the ormconfig.json file, subsequent migration can skip this step.
$ npm run pretypeorm
To create a blank migration file, run
$ npm run typeorm:migration:create -- <my_migration_file>
To generate migration file based on entity changes
$ npm run typeorm:migration:generate -- <my_migration_file>
To run the migrations (will run all migration files in src/database-config/migrations
)
$ npm run typeorm:migration:run
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov