Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
do4gr opened this issue May 18, 2020 · 0 comments · Fixed by prisma/prisma-engines#809
Closed

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

do4gr opened this issue May 18, 2020 · 0 comments · Fixed by prisma/prisma-engines#809
Assignees
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

Comments

@do4gr
Copy link
Member

do4gr commented May 18, 2020

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.

@janpio janpio added topic: re-introspection kind/feature A request for a new feature. labels May 18, 2020
@janpio janpio changed the title Enable re-introspection while keeping manual changes to relation field names [Re-introspection] Keep manual changes to relation field names May 18, 2020
@janpio janpio changed the title [Re-introspection] Keep manual changes to relation field names [Re-Introspection] Keep manual changes to relation field names May 18, 2020
@janpio janpio added the tech/engines Issue for tech Engines. label May 22, 2020
@janpio janpio added this to the 2.1.0 milestone Jun 10, 2020
@janpio janpio mentioned this issue Jun 23, 2020
7 tasks
@janpio janpio added the topic: previewFeatures Issue touches on an preview feature flag label Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants