Hey Prisma Friends, I have two repos that referenc...
# orm-help
h
Hey Prisma Friends, I have two repos that reference the same prisma file. Basically one is my backend and one is a repo with scripts. In the past I would run
yarn prisma generate
in both and that would generate my clients. For this I set the
schema
property in the package.json of the scripts:
Copy code
"prisma": {
    "schema": "../../backend/prisma/schema.prisma"
  },
I even have it documented like this. In the scripts repo a rather old version of prisma was installed (3.9.x) and today it stopped working, so I installed prisma 4 (as we have in the backend already). Calling
yarn prisma generate
from my scripts repo now generates the files in the backend and no longer for the client installed in scripts ⚠️. I am pretty sure this was not the old behaviour 😕 Is there a way how I can change that? How am I supposed to share a Prisma schema across repositories?
✅ 1
n
Hey 👋 So if I understand this correctly, setting the
schema
property was working for you but suddenly stopped working? Or did it stop working after you upgraded to prisma 4? For sharing prisma schema across repositories you can create a private npm package which exports the generated types and the PrismaClient instance. I have seen this approach being used by many users.
h
It also does not seem to work with prisma 3.10
I mean honestly, I have no idea how it ever worked. But I can't remember doing anything different and I did it also on all my colleagues' computers 🤔
I found a solution by using a simply symlink 😆 This is good enough for now. The client package is interesting, but a lot of work / maintenance…
n
Glad to hear that symlink worked for you. Yes, I can see how maintaining an npm package could cause an overhead.
👍 1