P
Prisma2w ago
Chola

Multi Schema files not being detected in ElysiaJS

I have a setup in ElysiaJS where my schema files are inside a directory called models, this has worked all along until Prisma 7, now my data models from other schema files are not being detected in schema.prisma when I generate. Below is just an example
model User {
id String
name String
company Company // <= comes from a schema in another file
}
model User {
id String
name String
company Company // <= comes from a schema in another file
}
2 Replies
Prisma AI Help
You opted for speed from this bot. Let's conjure up an answer right now! This is almost always a schema location / config issue with the new multi-file setup, not with ElysiaJS itself. From the docs and related issues, for multi-file schemas to work in Prisma 7 you must: 1. Point Prisma to the folder, not a single file If your structure is:
prisma/
schema.prisma // has datasource + generator
models/
user.prisma
company.prisma
prisma/
schema.prisma // has datasource + generator
models/
user.prisma
company.prisma
your config must point to the prisma folder (or whatever folder contains schema.prisma), not to schema.prisma itself. [Schema location] For example, using prisma.config.ts in your project root:
import path from 'node:path'
import type { PrismaConfig } from 'prisma'

export default {
schema: path.join('prisma'),
} satisfies PrismaConfig
import path from 'node:path'
import type { PrismaConfig } from 'prisma'

export default {
schema: path.join('prisma'),
} satisfies PrismaConfig
Or in package.json:
{
"prisma": {
"schema": "./prisma"
}
}
{
"prisma": {
"schema": "./prisma"
}
}
Or via CLI:
npx prisma generate --schema ./prisma
npx prisma generate --schema ./prisma
2. Ensure datasource is in a file in that folder schema.prisma (or another file in that folder) must contain the datasource block; Prisma then recursively loads all .prisma files under that folder. [Schema location] 3. Place migrations next to the datasource file If you’re using migrations, the migrations directory must sit next to the file that has the datasource:
prisma/
migrations/
schema.prisma
models/
user.prisma
company.prisma
prisma/
migrations/
schema.prisma
models/
user.prisma
company.prisma
[Schema location] 4. Common pitfall from issues If you only point to ./prisma/models (or to schema.prisma directly), Prisma will not see the other files correctly and relations like company Company won’t resolve. You must give the folder that contains the main schema file. [[Multi-file invalid](https://githu b.com/prisma/prisma/issues/27495); Multi-file not found] If after adjusting the config your models are still not detected, the knowledge sources don’t provide more Prisma‑7‑specific changes; in that case I’d double‑check that you removed any old prisma.schema setting that still points to a single file and open an issue with a minimal repo. ✅ Great, thanks for letting us know that this solved your question!
Aman
Aman7d ago
is this solved?

Did you find this page helpful?