Multiple schema - node_modules - prisma client
Hello,
I have one monorepository with the following structure :
/src
/service1
/prisma
prisma.schema
/service2
/prisma
prisma.schema
I'm using only one Dockerfile, and a docker compose to expose both services.
In dev environment, I want to be able to debug both services, but it seems that
npx --yes prisma generate --schema src/service1/prisma/schema.prisma
npx --yes prisma generate --schema src/service2/prisma/schema.prisma
the second command will erase the content of the first command in the .prisma folder in node_modules.
Is there any way to be able to generate prisma data from 2 different schemas ?
so according to the order of my generates command, one service is working and not the other one.
Any idea ?
5 Replies
Hi @JayPe 👋
Are you generating both schemas into a custom output directory?
Well,
I just found a solution !!!
In each schema.prisma file,
I added the following
So the generated code is now stored in each "service" folder, and just added a git ignore
like this It works like a charm
Generating Prisma Client | Prisma Documentation
This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.
Hey, we just do this in both of our schema.prisma files
@David , thanks, I prefer to have it in my service folder under prisma folder, to ease the readability for new dev coming in the project and who does not know how prisma works