Nest framework TypeScript starter repository.
$ yarn install
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
Create Migration
typeorm migration:create -n MigrationName
If migrations fails with function uuid_generate_v4() does not exist
you need to add uuid-ossp extention by executing SQL query on database:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
.
This should solve the problem.
Actually after adding
migrations
script to package.json and running it withnmp/yarn run migrations
this problem shouldn't arise
The config above mentions migrations to be found in js files:
migrations: [__dirname + '/Migrations/**/*.js'],
However from the folder structure its clear that migrations are written in ts files not js.
To run migrations from ts follow the officially recommended way described here:
Also in that case don't forget to update the migrations blob to be ts:
migrations: [__dirname + '/Migrations/**/*.ts'],
If you want to run the migrations from js files you will have to provide the location to be from dist folder after the ts files have been compiled to js form.