Skip to content

[Re-Introspection] Keep manual changes to relation field names #2503

@do4gr

Description

@do4gr

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions