mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Specify Alternate Location For Prisma Schema as a Prisma TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1252 TILs and counting..._
|
_1253 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -711,6 +711,7 @@ _1252 TILs and counting..._
|
|||||||
|
|
||||||
- [Execute A Raw SQL Query](prisma/execute-a-raw-sql-query.md)
|
- [Execute A Raw SQL Query](prisma/execute-a-raw-sql-query.md)
|
||||||
- [Grab A Limited Set Of Records](prisma/grab-a-limited-set-of-records.md)
|
- [Grab A Limited Set Of Records](prisma/grab-a-limited-set-of-records.md)
|
||||||
|
- [Specify Alternate Location For Prisma Schema](prisma/specify-alternate-location-for-prisma-schema.md)
|
||||||
|
|
||||||
### Python
|
### Python
|
||||||
|
|
||||||
|
|||||||
28
prisma/specify-alternate-location-for-prisma-schema.md
Normal file
28
prisma/specify-alternate-location-for-prisma-schema.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Specify Alternate Location For Prisma Schema
|
||||||
|
|
||||||
|
By default, Prisma looks for a schema in one of two locations:
|
||||||
|
|
||||||
|
- `./prisma/schema.prisma`
|
||||||
|
- `./schema.prisma`
|
||||||
|
|
||||||
|
If it isn't in one of those two spots, then you'll get an error.
|
||||||
|
|
||||||
|
You can manually specify an alternate location. One way is to use the
|
||||||
|
`--schema` flag with all `prisma` commands. A less tedious approach
|
||||||
|
([introduced in this PR](https://github.com/prisma/prisma/pull/3566)) is to
|
||||||
|
specify the location in your `package.json`.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"prisma": {
|
||||||
|
"schema": "../../packages/database/prisma/schema.prisma"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is handy in situations where your database schema and utils are packaged
|
||||||
|
up separately, like in a monorepo. Here is an example of [a monorepo
|
||||||
|
referencing a prisma schema in a separate
|
||||||
|
package](https://github.com/skillrecordings/products/blob/b10dece7170abcb9076221c0863549e2291541ae/apps/testingaccessibility/package.json#L201-L203).
|
||||||
|
|
||||||
|
[source](https://www.prisma.io/docs/concepts/components/prisma-schema#prisma-schema-file-location)
|
||||||
Reference in New Issue
Block a user