Multi-file prisma schema setup not working.
I currently have the following setup:
When I run
bun prisma generate
for some reason, it's not seeing ANY models within the users.prisma
file, nor is it loading them.
I have added:
to the package.json
file but it just isn't seeing the other *.prisma files.7 Replies
You selected the bot's instantaneous insights. Let me compile your answer right away!
A few things to check for multi-file schemas:
1) Point Prisma to the folder (not a file)
- Your package.json is correct:
This tells Prisma to recursively load all .prisma files under prisma/. [Schema location]
2) Ensure datasource/generator live in a file inside that folder
- You must have a .prisma file in prisma/ (e.g., prisma/schema.prisma) that defines your datasource (and usually generator). Prisma discovers other files from that anchor. [Schema location]
3) Migrations folder placement
- If you use migrations, the migrations directory must be next to the .prisma file that defines the datasource (i.e., prisma/migrations alongside prisma/schema.prisma). [Config reference; Schema location]
4) Do not point to a single file
- Avoid commands like --schema ./prisma/schema.prisma when using multi-file; that will ignore other files. Always pass the folder (./prisma) or rely on package.json. [Issue 26849; Issue 27495 cmt]
5) Keep generated artifacts outside the schema folder
- If a generator outputs into a subfolder of prisma (e.g., prisma/generated), Prisma will also scan those .prisma copies and you may get duplicate datasource errors. Configure generator output outside prisma. [Issue 27495 cmt]
6) If using prisma.config.ts
- Prefer placing prisma.config.ts at repo root, and set:
Don’t put prisma.config.ts inside prisma/. [Issue 27974; Config reference]
Quick checklist for your structure:
- prisma/schema.prisma contains datasource (and generator).
- prisma/models/users.prisma contains only models/enums (no second datasource).
- package.json has "prisma.schema": "./prisma".
- Generator output not inside prisma/.
- Run: npx prisma validate and npx prisma generate (or bun prisma generate) without --schema pointing to a file.
If it still doesn’t work, please share:
- schema.prisma (datasource/generator blocks)
- users.prisma (ensure only models)
- Your generator output path
This will help pinpoint if Prisma is only seeing the anchor file or being confused by extra files. [Schema location; Issue 27495 cmt]
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
This doesn't solve the issue at all
schema.prisma
./models/users.prisma
I am importing from the generated client, but no dice
Ah funnily enough if I use, yet another, config file then it works....Is this happening in latest prisma version 6.16.0?
Could you share a minimal reproduction for me to look at?
this setup is not working for me either, please check the screen shots, however when i point prisma to exact schema.prisma file then it complains of no models in schema.prisma files, I have tried every solution propsoed so far, couldn't get it to work .


Hey both, have you created a
prisma.config.ts
file, that points to the folder instead of the single schema file?
An example:
In my case, the path is db/prisma/schema/
where schema is a folder in which all my models live.
Does this work for you?
But I thought we could do this with the package.json? Why do we need another config file?
Because the configuration in package.json is being deprecated as of version 7.
I have never managed to get the
package.json
config to work with multi schema, I wonder if its not supported from there, seeing its being deprecated. Just speculation in any case.
I cant claim to know why 🙂