Multiple prisma clients and databases #3493
Replies: 2 comments 13 replies
-
Hi @emilbryggare, did you find out how to solve that? I have my turbo repo project manages with Yes I'm getting a very very weird behavior when trying to generate codes, because of symlinks pnpm strategy, my generated codes are overwriting each others and I'm not able to use my Prisma logics correctly |
Beta Was this translation helpful? Give feedback.
-
Looks like @Neosoulink's answer is working for folks, judging by emoji reactions!
In the interest of cleaning up our GitHub Discussions, I'll mark this as closed! (I would mark it as answered but the GitHub UI isn't letting me do so.) 😄 |
Beta Was this translation helpful? Give feedback.
-
Using Prisma with Turborepo works great when following https://turbo.build/repo/docs/handbook/tools/prisma if there is only one Prisma client in the monorepo.
However, when running Turborepo with multiple Prisma clients and databases they will overwrite each other. It is OK if you only use one database per app, then you would just have to be careful when you run
prisma generate
so the client is generated for the app you are working on.But if you have multiple clients/databases in one app things get more difficult. There are loads of hacks out there, some mentioned here prisma/prisma#10433 (comment) but no real solutions as far as I can tell.
I've added a simple reproduction of the use case based on with-prisma example here: emilbryggare#1
Just wanted to raise awareness of this here and maybe it is worth adding a caveat to the docs about this so users are aware. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions