| sidebar_position | 11 |
|---|---|
| description | Breaking down complex schemas into multiple files |
import ZModelVsPSL from '../_components/ZModelVsPSL';
Prisma uses an implicit approach that simply merges all schema files in a folder. ZModel uses explicit `import` syntax for better clarity and flexibility.When your schema grows large, you can break them down to smaller files and stitch them together using the import statement.
import './post'
model User {
id Int @id
posts Post[]
}import './user'
model Post {
id Int @id
content String
author User @relation(fields: [authorId], references: [id])
authorId Int
}import './user'
import './post'After type-checking, these files are merged into a single schema AST before passed to the downstream tools.