Make order of introspected foreign keys stable #8975
Labels
kind/tech
A technical change.
team/schema
Issue for team Schema.
tech/engines/introspection engine
Issue in the Introspection Engine
topic: introspection
Milestone
On tables with 2 foreign keys on the same columns, Prisma does not always choose the same one to represent right now (and it can only represent one of them, see #8976). That is problematic, as it triggers noise in our Introspection CI and also can lead to confusing changes for users.
Take the following (My)SQL:
This is introspected as follows:
But sometimes also as:
Note the difference in
member
:Per @pimeys this is probably caused by usage of a
HashMap
in the code somewhere to represent the Introspection query used to get these (probably https://github.com/prisma/prisma-engines/blob/master/libs/sql-schema-describer/src/mysql.rs#L529). If we make this deterministic, we still can not represent both FKs of course, but at least we will always choose the same one.The text was updated successfully, but these errors were encountered: