Commit da6fa1f
committed
fix(build/prisma): support custom schema directories and Prisma 6.6+ compatibility
This change makes the Prisma build extension work with any schema directory name
(e.g. "schema", "models", "db", "prisma-schemas") and ensures compatibility with Prisma 6.6+.
Configuration:
Always point the `schema` option to your main schema file, not the folder:
prismaExtension({
version: "6.18.0",
schema: "../../packages/prisma/src/models/schema.prisma", // ← Point to the file
migrate: false,
})
The main schema file can have any name (schema.prisma, main.prisma, etc.) and can live
in any directory. It does NOT have to be called "schema.prisma".
How it works:
- Auto-detects a "schema folder" by checking the parent directory of the schema file
for multiple .prisma files. If 2+ .prisma files exist in that directory, we treat
it as a folder-based schema setup.
- For folder-based schemas (multiple files), all .prisma files in that directory are
copied to ./prisma/schema/ in the build output. For Prisma >= 6.6, we run:
prisma generate --schema=./prisma/schema
For older Prisma versions, we omit the --schema flag for backwards compatibility.
- For single-file schemas (only one .prisma file in the directory), the file is copied
to ./prisma/schema.prisma and we run:
prisma generate --schema=./prisma/schema.prisma
Examples:
# Folder-based (multiple .prisma files):
packages/prisma/src/models/
├── schema.prisma ← Point to this in config
├── user.prisma
└── post.prisma
# Single file:
packages/prisma/
└── schema.prisma ← Point to this in config
Backwards compatibility:
- Older Prisma versions (< 6.6) continue to work without the --schema flag for folder setups
- Single-file setups are unaffected
- No breaking changes
Closes #19261 parent 9fdf91a commit da6fa1f
1 file changed
+14
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
155 | 160 | | |
156 | 161 | | |
157 | 162 | | |
158 | | - | |
159 | | - | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
164 | | - | |
| 167 | + | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| |||
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 | | |
187 | | - | |
188 | | - | |
189 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
190 | 197 | | |
191 | 198 | | |
192 | 199 | | |
| |||
0 commit comments