Skip to content

Latest commit

 

History

History
82 lines (61 loc) · 3.8 KB

README.md

File metadata and controls

82 lines (61 loc) · 3.8 KB

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Setup environment variables

  1. Create .env file and copy there contents from .env_sample
  2. Fill in all DATABASE values
    • You can create free PostgreSQL database on https://aiven.io (no credit card needed)

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:coverage

Migrations

  1. Make some changes to the files with suffix *.entity.ts
  2. Decide name for migration (eg. new-username-column)
  3. 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
  4. If you want to run migration use npm run migration:run
    • Check that database was affected as expected

Reverting migrations

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...