Home > Enterprise >  NestJs with TypeORM migrations fail
NestJs with TypeORM migrations fail

Time:07-15

I use this boilerplate app to learn NestJs GITHUB LINK. The template is amazing but there was one thing that I can't fix migrations. When I try to add a new entity or use an existing one with npm run migrate:create Init migration was successful

Migration D:/src/database/migrations/1657796180301-init.ts

has been generated successfully. but without any updating on the migration file or database. Only If I use synchronize: true and start the app the database was updated.

CodePudding user response:

try to run migration:generate to generate new migrate file.

CodePudding user response:

You have to run migration:run to apply migrations. This process is not done automatically because some migrations will cause you to loose data (dropping a column for example), so this gives you a chance to validate migration file before applying it.

  • Related