Skip to content

allow empty dbgenerated attribute #12

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonapgar-groupby
Copy link

Some developers have added empty dbgenerated() attributes to their schema to support GENERATED columns in postgres. See prisma/prisma#20077

Prior to the changes in tjis PR, drizzle-prisma-generator will throw an error when dbgenerated() is empty.

Cannot read properties of undefined (reading 'replace')

The error message is largely unhelpful, because there isn't an easy way to get the stack-trace from the prisma cli. However by examining the code you can see that the dbgenerated handling expects there always to be an argument for this attribute.

This change allows for empty dbgenerated attributes (no arg), and declares them as GENERATED columns. We use a dummy SQL for the generated expression, since we have no way of knowing the actual expression or value the developer actually used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant