0

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.

2 Answers2

2

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

Num
  • 170
  • 5
0

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.

omidh
  • 2,526
  • 2
  • 20
  • 37
  • Yes but the problem is that with npm run migrate:create Init does not apply or create any table from entities. The migrations files are empty. Just try it, before that delete the migrations folder. – Vladimir Petukhov Jul 14 '22 at 14:45