Closed krumft closed 1 year ago
After some debugging it seems that the root cause is that in pg-mem
when a constraint is being dropped the field usedInIndexes
in the column representation is not updated. When adding the constraint the system creates an index and that field is updated. This is why when the column is dropped in the next statement of our test, the system sees the REL_constraint
index inside usedInIndexes
and tries to drop it.
Raised https://github.com/oguimbal/pg-mem/pull/308 to fix this.
Hi !
Thanks for the PR, I released it as pg-mem@2.6.9
Great, thank you!
Our application is using
typeorm
version0.3.11
against a Postgres database, and we maintain our DB schema in TypeScript migrations. These are getting executed successfully by the ORM framework against the 'real' Postgres db.We have recently started adopting
pg-mem
to write unit tests (well ... ok, integration tests) for our entities and repositories. We are using version2.6.8
of the package. We do execute all application migrations before each test.Following scenario is failing for us, it is taken from a real-world migration that succeeds against Postgres:
fails with:
We have worked the problem around with this hack:
Still, it would be great if
pg-mem
aligns better with Postgres on the behaviour in this scenario.