简体   繁体   中英

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.

尝试运行migration:generate以生成新的迁移文件。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM