Hi , is there any way to customize generating  Pri...
# orm-help
s
Hi , is there any way to customize generating  PrismaClient process? Now I am implementing the backend of Saas and the strategy of db is shared table(table have tenant_id column). To add the value of tenant at create and add the where tennatId = XXXX at findXXXXX and so on, I am using Prisma Middleware now. I have one problem now and that is like this (below is example). User_profile table have tenant_id column which is required. And in the type definition of prisma.userProfile.create , tenant is required too , but the best for us is tenant is not in this type definition (because the value is decided by Middleware). So I want to customize generating  PrismaClient process. (It is the best solution for me that I can add @MiddlewareCreateValue to tenant attribute in my schema )
r
@Sunao Suzuki 👋 Unfortunately that isn’t possible at the moment. You would need to pass a dummy value as of now as Prisma requires those parameters. There’s a similar feature request that you can add a 👍 on and your use case 🙂
s
@Ryan Thank you for response. In my understanding , generator create PrisimaClienet. Is this right? If so , can you let me know where is generator source code? because I will consider I can implement or not by myself.
r
I’m not sure, but this validation would most probably be performed by the Query Engine.
👍 1