Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1021 Bytes

specify-alternate-location-for-prisma-schema.md

File metadata and controls

28 lines (21 loc) · 1021 Bytes

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) is to specify the location in your package.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.

source