MrLeebo/prisma-ast

Add support for views

toxsick opened this issue · 4 comments

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!

@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?

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

Thanks a lot and have a nice weekend!

@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.

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

Thanks a lot and have a good day!