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

Add support for views #18

Closed
toxsick opened this issue Apr 11, 2023 · 4 comments · Fixed by #19
Closed

Add support for views #18

toxsick opened this issue Apr 11, 2023 · 4 comments · Fixed by #19

Comments

@toxsick
Copy link

toxsick commented Apr 11, 2023

Hey there,

prisma recently add experimental support for views:

https://www.prisma.io/docs/concepts/components/prisma-schema/views

Could this be supported? Currently printSchema will remove views.

Big thanks and regards!

@MrLeebo
Copy link
Owner

MrLeebo commented Apr 11, 2023

@toxsick interesting request. I can see it working by basically parsing views in the same way as models. The builder would have a new .view() helper, e.g.

builder.view("UserInfo").field('value', 'Json')

creates

view UserInfo {
  value Json
}

Does that sound correct to you?

@toxsick
Copy link
Author

toxsick commented Apr 14, 2023

Hey @MrLeebo, that sounds super correct and would be nice to have!

Thanks a lot and have a nice weekend!

@MrLeebo
Copy link
Owner

MrLeebo commented Jun 7, 2023

@toxsick Please install v0.6.0 and see that it works as you expect. Please note that builder.modelAttribute() has been renamed to builder.blockAttribute() since it is relevant to both models and views now.

@toxsick
Copy link
Author

toxsick commented Jun 7, 2023

@MrLeebo AWESOME 🥳 Works perfectly, now I can use Prisma Views in PROD.

Thanks a lot and have a good day!

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 a pull request may close this issue.

2 participants