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

Surface schema validation errors during Re-Introspection and change flow #3082

Closed
do4gr opened this issue Jul 20, 2020 · 3 comments · Fixed by prisma/prisma-engines#963
Closed
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 Jul 20, 2020

(Currently Re-Introspection is in an experimental state and has its own flag to be activated.)

The command prisma introspection --experimental-reintrospection just returns a warning when it receives an invalid Prisma schema (that it needs to work its Re-Introspection magic). It then proceeds to run a normal prisma introspection and still delivers a valid schema.

This can be annoying for users with big schemas, that make it hard to pinpoint the reason why the schema is invalid. See #3044 (comment)

We should change this behavior to instead error out and return the validation errors for the invalid schema. Additionally, we should introduce a flag that allows the user to ignore the invalid schema (--clean, --fresh, --force, --overwrite or similar).

This is what this would look like:

CLI Command Valid Previous Schema Invalid Previous Schema
prisma introspection --experimental-reintrospection success, enriched schema based on db state and previous schema error, list schema validation errors
prisma introspection --experimental-reintrospection --clean success, raw schema based on db state success, raw schema based on db state
prisma introspection success, raw schema based on db state success, raw schema based on db state

After Re-Introspection leaves the experimental state the commands can be collapsed into:

CLI Command Valid Previous Schema Invalid Previous Schema
prisma introspection success, enriched schema based on db state and previous schema error, list schema validation errors
prisma introspection --clean success, raw schema based on db state success, raw schema based on db state
@janpio janpio added topic: previewFeatures Issue touches on an preview feature flag topic: re-introspection labels Jul 20, 2020
@janpio janpio changed the title Return Schema Validation Errors from Re-Introspection Surface schema validation errors during Re-Introspection and change flow Jul 20, 2020
@janpio janpio added the kind/feature A request for a new feature. label Jul 20, 2020
@janpio janpio added this to the 2.4.0 milestone Jul 22, 2020
@janpio janpio added tech/engines Issue for tech Engines. and removed process/candidate labels Jul 22, 2020
@mavilein
Copy link
Member

Internal Note: @do4gr has implemented the engines part. Awaiting integration on CLI side.

Jolg42 pushed a commit that referenced this issue Jul 29, 2020
timsuchanek pushed a commit that referenced this issue Jul 29, 2020
Related #3082

Co-authored-by: prisma-bot <prismabots@gmail.com>
@Jolg42
Copy link
Member

Jolg42 commented Jul 30, 2020

CLI implementation is done in 2.4.0-dev.30, if everything works as expected this could be closed.

@janpio
Copy link
Member

janpio commented Jul 30, 2020

What error message does a user get when the Re-Introspection fails that tells them to use --clean?

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.

4 participants