Skip to content

[BUG] zmodel does not support calling @default(dbgenerated()) with no parameters #1400

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

Closed
clementoriol opened this issue May 1, 2024 · 2 comments
Milestone

Comments

@clementoriol
Copy link
Contributor

clementoriol commented May 1, 2024

Description and expected behavior

Description
Prisma does not support have first-class support for Postgres generated columns but they still kind of work if you :

  • Write the migration yourself
  • Declare them in the prisma schema as optional with @default(dbgenerated()) (see the prisma docs)
generatedField    String?                 @default(dbgenerated()) /// note the empty argument

Issue
However, zmodels don't seem to allow calling dbgenerated() without arguments. Running zenstack generate with the previous example will output the following error :

missing argument for parameter "expr"

Expected behavior
zmodels should allow @default(dbgenerated()) and generate the prisma schema accordingly

Environment

  • ZenStack version: 2.0.2
  • Prisma version: 5.10.2
  • Database type: Postgresql
@ymc9
Copy link
Member

ymc9 commented May 2, 2024

Thanks for providing the fix @clementoriol !

@ymc9 ymc9 added this to the v2.1.0 milestone May 2, 2024
ymc9 pushed a commit that referenced this issue May 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@ymc9
Copy link
Member

ymc9 commented May 5, 2024

Fixed in release 2.0.3.

@ymc9 ymc9 closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants