From 7e1d734f6cf3f6640beb75d4b0335984f815a0cd Mon Sep 17 00:00:00 2001 From: Aidan Date: Thu, 27 Mar 2025 12:20:37 -0500 Subject: [PATCH 1/4] [6.6.0] Schema Folder Docs Update --- .../10-overview/04-location.mdx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx index ce40444b4f..648d497b6c 100644 --- a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx @@ -65,6 +65,43 @@ my-app/ ├─ ... ``` +### Schema resolution order + +Prisma now resolves the schema file or folder in this order: + +1. `--schema` CLI flag (path relative to the current working directory) +2. `schema` field in `prisma.config.ts` (path relative to the config file) +3. `prisma.schema` field in `package.json` (path relative to the package.json) +4. Default locations: `./schema.prisma` and `./prisma/schema.prisma` (relative to the project root) + +#### Referenced paths + +Any paths referenced within a schema (e.g. SQLite file paths) are resolved **relative to the schema file** itself. + +#### Migrations, views, and typed SQL + +The `migrations`, `views`, and `sql` directories are now placed **next to the schema file that contains the `datasource` block**. + +``` +my-app/ +├─ ... +├─ prisma/ +│ ├─ migrations/ +│ ├─ views/ +│ ├─ sql/ +│ ├─ schema/ +│ │ ├─ post.prisma +│ │ ├─ user.prisma +│ ├─ schema.prisma # contains `datasource` +├─ ... +``` + +:::info + +Making this placement more configurable is planned for **6.7.0** via `prisma.config.ts`. + +::: + ### How to enable multi-file Prisma schema support Support for multiple Prisma Schema files is currently in preview. To enable the feature, add the `prismaSchemaFolder` feature flag to the `previewFeatures` field of the `generator` block in your Prisma Schema: From 8e3ce0e8a39e20bc832267b4d88e507883a178ab Mon Sep 17 00:00:00 2001 From: Aidan Date: Thu, 27 Mar 2025 13:39:49 -0500 Subject: [PATCH 2/4] Wording changes --- .../200-orm/100-prisma-schema/10-overview/04-location.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx index 648d497b6c..a99d8f9eac 100644 --- a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx @@ -67,7 +67,7 @@ my-app/ ### Schema resolution order -Prisma now resolves the schema file or folder in this order: +Prisma ORM resolves the schema file or folder in this order: 1. `--schema` CLI flag (path relative to the current working directory) 2. `schema` field in `prisma.config.ts` (path relative to the config file) @@ -76,11 +76,11 @@ Prisma now resolves the schema file or folder in this order: #### Referenced paths -Any paths referenced within a schema (e.g. SQLite file paths) are resolved **relative to the schema file** itself. +Any paths referenced within a schema (e.g. SQLite file paths) are resolved **relative to the `schema.prisma` file** itself. #### Migrations, views, and typed SQL -The `migrations`, `views`, and `sql` directories are now placed **next to the schema file that contains the `datasource` block**. +The `migrations`, `views`, and `sql` directories are placed **next to the schema file that contains the `datasource` block**. ``` my-app/ From 5e1835dfbacf55a6ae1e976133af7767215e8ca9 Mon Sep 17 00:00:00 2001 From: Aidan Date: Fri, 28 Mar 2025 08:54:17 -0500 Subject: [PATCH 3/4] wording changes --- .../200-orm/100-prisma-schema/10-overview/04-location.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx index a99d8f9eac..48a9a703a8 100644 --- a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx @@ -71,14 +71,14 @@ Prisma ORM resolves the schema file or folder in this order: 1. `--schema` CLI flag (path relative to the current working directory) 2. `schema` field in `prisma.config.ts` (path relative to the config file) -3. `prisma.schema` field in `package.json` (path relative to the package.json) +3. `prisma.schema` field in `package.json` (path relative to the `package.json`) 4. Default locations: `./schema.prisma` and `./prisma/schema.prisma` (relative to the project root) #### Referenced paths -Any paths referenced within a schema (e.g. SQLite file paths) are resolved **relative to the `schema.prisma` file** itself. +Any paths referenced within a Prisma schema file (e.g. SQLite file paths) are resolved _relative_ to that file itself. -#### Migrations, views, and typed SQL +#### Migrations, views, and TypedSQL The `migrations`, `views`, and `sql` directories are placed **next to the schema file that contains the `datasource` block**. @@ -98,7 +98,7 @@ my-app/ :::info -Making this placement more configurable is planned for **6.7.0** via `prisma.config.ts`. +In the future, file placements can be customized via `prisma.config.ts`, allowing you to define locations that best suit your project's structure. ::: From 23d17d78bed8a6d0ed91aca31c28777589892a61 Mon Sep 17 00:00:00 2001 From: Aidan Date: Fri, 28 Mar 2025 08:54:59 -0500 Subject: [PATCH 4/4] links added --- content/200-orm/100-prisma-schema/10-overview/04-location.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx index 48a9a703a8..b0eaaf71b2 100644 --- a/content/200-orm/100-prisma-schema/10-overview/04-location.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx @@ -104,7 +104,7 @@ In the future, file placements can be customized via `prisma.config.ts`, allowin ### How to enable multi-file Prisma schema support -Support for multiple Prisma Schema files is currently in preview. To enable the feature, add the `prismaSchemaFolder` feature flag to the `previewFeatures` field of the `generator` block in your Prisma Schema: +Support for [multiple Prisma Schema files](/orm/prisma-schema/overview/location#multi-file-prisma-schema) is currently in [preview](/orm/reference/preview-features/client-preview-features). To enable the feature, add the `prismaSchemaFolder` feature flag to the `previewFeatures` field of the `generator` block in your Prisma Schema: ```prisma file=schema.prisma showLineNumbers generator client {