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

Error in migration engine: We should only be setting a changed default if there was one on the previous schema and in the next with the same enum. #15927

Closed
jkomyno opened this issue Oct 21, 2022 · 1 comment
Labels
kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema topic: error reporting Issues created via Prisma's CLI Crash Reporting topic: postgresql

Comments

@jkomyno
Copy link
Contributor

jkomyno commented Oct 21, 2022

Command: prisma migrate dev
Version: 4.5.0
Binary Version: 0362da9eebca54d94c8ef5edd3b2e90af99ba452
Report: https://prisma-errors.netlify.app/report/14387
OS: arm64 darwin 21.6.0

Rust Stacktrace:

Starting migration engine RPC server
Analysis run in 26ms
[migration-engine/connectors/sql-migration-connector/src/sql_renderer/postgres_renderer.rs:1011:22] We should only be setting a changed default if there was one on the previous schema and in the next with the same enum.

Context

This error is happening because we're attempting to unwrap a None value into default_str via an expect() call:

https://github.com/prisma/prisma-engines/blob/1efe6d372597cdb48067c5dd1f441702a1b0861e/migration-engine/connectors/sql-migration-connector/src/sql_renderer/postgres_renderer.rs#L1006-L1020

Potential Solution

I think we should conditionally apply the SET DEFAULT expression in the pushed statement only when default_str is a Some(_). I could easily do that as a side task.

@jkomyno jkomyno added kind/bug A reported bug. tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema topic: error reporting Issues created via Prisma's CLI Crash Reporting team/schema Issue for team Schema. topic: postgresql process/candidate labels Oct 21, 2022
@tomhoule
Copy link
Contributor

tomhoule commented Oct 24, 2022

I am pretty sure this is a duplicate of #15705

@tomhoule tomhoule closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema topic: error reporting Issues created via Prisma's CLI Crash Reporting topic: postgresql
Projects
None yet
Development

No branches or pull requests

3 participants