Vladimir Petukhov
Vladimir Petukhov

Reputation: 107

NestJs with TypeORM migrations fail

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.

Upvotes: 0

Views: 1562

Answers (2)

Num
Num

Reputation: 190

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

Upvotes: 2

omidh
omidh

Reputation: 2822

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.

Upvotes: 0

Related Questions