Skip to content

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