nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇
https://nestjs.com
MIT License
1.93k stars 206 forks source link

Every migration:generate creates DROP/CREATES constraints and keys #1843

Closed amilkarSingular closed 10 months ago

amilkarSingular commented 10 months ago

Is there an existing issue for this?

Current behavior

When I run migration:generate and migration:run and the first time it generate me the CREATE TABLE and index fine and migrations runs perfect, but at the second time (without change anything in tables), it generate me ALTER TABLE DROP and ADD constraints queries of all entities again, like if synchronize was turn on.

Minimum reproduction code

https://github.com

Steps to reproduce

npm run migration:generate npm run migration:run

Expected behavior

At the second time without any changes in entities, the output of migration:generate should be empty in up() and down() functions.

At the next time with some changes in entities, the output should be SQL queries with only the changes I made, not changes I made + DROP/CREATES constraints.

Even I run it it throw me error saying "some constraints already exists"

Package version

10.0.1

NestJS version

10.2.4

Node.js version

21.1.0

In which operating systems have you tested?

Other

No response

micalevisk commented 10 months ago

this has nothing to do with @nestjs/typeorm

please report this to https://github.com/typeorm/typeorm