[Re-Introspection] Keep manual changes to relation field names #2503
Labels
kind/feature
A request for a new feature.
tech/engines
Issue for tech Engines.
topic: previewFeatures
Issue touches on an preview feature flag
topic: re-introspection
Milestone
Problem
If you have a table User, and a table that has a FK to that table, it will be introspected as
User User? @relation(fields: [userId], references: [id])
This means that User will also be the key in the Client API
If you now want to rename this to authors for example, you can do so by changing it to
authors User? @relation(fields: [userId], references: [id])
in the schema.Problem: Next time you run prisma introspect this will be overwritten again, as the name
authors
is not persisted in the database.Suggested solution
As a first prototype of Re-Introspection, we could keep the name
authors
after the next Prisma introspect by providing the old datamodel as additional input for introspection.The text was updated successfully, but these errors were encountered: