A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ npm install
- Create
.env
file and copy there contents from.env_sample
- Fill in all
DATABASE
values- You can create free PostgreSQL database on https://aiven.io (no credit card needed)
# 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:coverage
- Make some changes to the files with suffix
*.entity.ts
- Decide name for migration (eg.
new-username-column
) - Run
npm run migration:generate --name=new-username-column
- Check that new file was generated under migrations/history
- Check that SQL query inside the file corresponds to what you wanted
- If you want to run migration use
npm run migration:run
- Check that database was affected as expected
Migrations can be reverted using npm run migration:revert
which will call down function
on the latest migration file
- After that migration record will be removed from
migrations
table in database - If you want to revert multiple migrations, just run this command multiple times...