Skip to content

Postgres: migration:generate drops and recreates all FKs continuously #5655

@SeWaS

Description

@SeWaS

Issue type:

[X] question
[X] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[X] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[ ] latest
[ ] @next
[X] 0.2.24 (or put your version here)

Steps to reproduce or a small repository showing the problem:

Hello 👋
It seems that after upgrading typeORM from version 0.2.22 to version 0.2.24 in my project the cli command migration:generate -n migrationName drops all FKs and regenerates them again, even when running the command multiple times without changing relations, entites, etc.

Maybe 7157cb3 and issue #5119 relate to this?
I'm not so deep into the typeORM code at the moment but the added check (tableForeignKey.referencedTableName === metadataForeignKey.referencedTablePath) in line 795 seems to always return false...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions