Closed JYachelini closed 1 year ago
Thanks for bringing this up @JYachelini . I think there should be a good chance that we can suppress the generation of the zenstack_guard
field when access policies are not used. Just to confirm, you not using any @@allow
and @@deny
attributes, right?
As to the output location of schema.prisma, it can be configured by the @core/prisma
plugin as shown here:
https://zenstack.dev/docs/reference/plugins/prisma
Thanks for the explanation of @core/prisma
@ymc9
I'm not using any @@allow
and @@deny
. I don't need it, so the zenstack_guard
is not necessary.
Got it. Thanks for the confirmation! Let me look into that.
Just out of curiosity: what is the main extension that ZenStack made to Prisma that you're using now?
I use ZenStack because I can modularize the schemas and also extend from the Base model. Also saw some options in the documentation that I liked but have not implemented yet. I don't know if you are referring to an extension to this I told you about
abstract model Base {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
deletedAt DateTime?
}
Yes, that's what I meant by extensions haha. Thanks for letting me know!
Fixed by #436
Hey @JYachelini , with the new alpha.119 release, the auxiliary fields won't be generated for models without access policies.
Nice! @ymc9 Thanks!!
Problem Hi, I am using zenstack for an API. I accessed zenstack only to modularize prisma schemas and to be able to extend schemas, they seemed to me very good features that prisma should include, but it doesn't do it.
The problem I have is that it always generates the zenstack_guard column when I don't need it, since I'm not going to use auth() because I do it from my API controller.
To solve this problem I had to use the "sed" command and when the zenstack generate command is executed, the sed command deletes the zenstack_guard lines. Example: 'npx zenstack generate && sed -i '' 's/zenstack_guard Boolean @default(true)//g' prisma/schema.prisma && npx prisma generate.
Posible solution (feature) The simplest solution is to add in the zenstack.config.json something like "guardField": Boolean (default true)
zenstack.config.json
I hope I have explained it well.
Aditional It would be nice to add the option to choose the output of zenstack generate in zenstack.config.json, if it already exists I did not find it.
zenstack.config.json