From b6e75c2aa13af5579d6dfeb3c1308ad6e7a9c432 Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:57:57 -0500 Subject: [PATCH 01/18] add initial docs for multi-file Prisma schema and clean up references to singular Prisma schema file --- content/100-getting-started/01-quickstart.mdx | 2 +- .../150-introspection-node-cockroachdb.mdx | 2 +- .../150-introspection-node-mysql.mdx | 2 +- .../150-introspection-node-planetscale.mdx | 2 +- .../150-introspection-node-postgresql.mdx | 2 +- .../150-introspection-node-sqlserver.mdx | 2 +- ...0-introspection-typescript-cockroachdb.mdx | 2 +- .../150-introspection-typescript-mysql.mdx | 2 +- ...0-introspection-typescript-planetscale.mdx | 2 +- ...50-introspection-typescript-postgresql.mdx | 2 +- ...150-introspection-typescript-sqlserver.mdx | 2 +- .../100-introduction/100-what-is-prisma.mdx | 2 +- .../04-is-prisma-an-orm.mdx | 4 +- .../500-databases/300-postgresql.mdx | 2 +- .../050-overview/500-databases/400-mysql.mdx | 2 +- .../050-overview/500-databases/500-sqlite.mdx | 2 +- .../500-databases/600-mongodb.mdx | 10 +-- .../500-databases/800-sql-server/index.mdx | 2 +- .../500-databases/840-cockroachdb.mdx | 6 +- .../10-overview/03-generators.mdx | 2 +- .../100-prisma-schema/10-overview/index.mdx | 46 +++++++----- .../20-data-model/40-views.mdx | 2 +- .../20-data-model/60-multi-schema.mdx | 4 +- .../20-data-model/90-multiple-files.mdx | 71 +++++++++++++++++++ .../100-prisma-schema/50-introspection.mdx | 4 +- .../80-postgresql-extensions.mdx | 2 +- .../400-deploy-to-aws-lambda.mdx | 4 +- .../070-migration-histories.mdx | 2 +- .../300-workflows/100-team-development.mdx | 4 +- .../120-native-database-functions.mdx | 2 +- .../200-prisma-cli-reference.mdx | 4 +- .../050-client-preview-features.mdx | 1 + .../600-upgrading-to-prisma-5/index.mdx | 2 +- .../700-upgrading-to-prisma-4.mdx | 2 +- .../03-upgrading-the-prisma-layer-mysql.mdx | 2 +- ...-upgrading-the-prisma-layer-postgresql.mdx | 2 +- .../05-upgrading-prisma-binding-to-nexus.mdx | 2 +- .../01-migrate-from-typeorm.mdx | 4 +- .../02-migrate-from-sequelize.mdx | 4 +- .../03-migrate-from-mongoose.mdx | 4 +- .../04-migrate-from-drizzle.mdx | 4 +- .../040-env-files.mdx | 2 +- docusaurus.config.ts | 2 +- 43 files changed, 155 insertions(+), 75 deletions(-) create mode 100644 content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx diff --git a/content/100-getting-started/01-quickstart.mdx b/content/100-getting-started/01-quickstart.mdx index bd6495ae0b..837b177015 100644 --- a/content/100-getting-started/01-quickstart.mdx +++ b/content/100-getting-started/01-quickstart.mdx @@ -63,7 +63,7 @@ Finally, set up Prisma ORM with the `init` command of the Prisma CLI: npx prisma init --datasource-provider sqlite ``` -This creates a new `prisma` directory with your Prisma schema file and configures SQLite as your database. You're now ready to model your data and create your database with some tables. +This creates a new `prisma` directory with a `prisma.schema` file and configures SQLite as your database. You're now ready to model your data and create your database with some tables. ## 2. Model your data in the Prisma schema diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx index f9bc98bf11..788ba00c96 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-cockroachdb.mdx @@ -83,7 +83,7 @@ npx prisma db pull This command reads the environment variable used to define the `url` in your `schema.prisma`, `DATABASE_URL`, that in our case is set in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx index d33b1d28c0..b5c76da70e 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-mysql.mdx @@ -81,7 +81,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx index a743a74f68..2f4b0c4955 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-planetscale.mdx @@ -89,7 +89,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx index d1781966bc..2a5febf211 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-postgresql.mdx @@ -84,7 +84,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a data model in your Prisma schema. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database with Prisma ORM](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx index 3c67e5be75..9941291dd4 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-node-sqlserver.mdx @@ -91,7 +91,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx index 8f0d54e1ff..bd3d478c53 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-cockroachdb.mdx @@ -84,7 +84,7 @@ npx prisma db pull This command reads the environment variable used to define the `url` in your `schema.prisma`, `DATABASE_URL`, that in our case is set in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx index 5c96ab1b90..3d420aeaaa 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-mysql.mdx @@ -82,7 +82,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx index ed7a92cbc2..bfe87aadc1 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-planetscale.mdx @@ -89,7 +89,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx index 6c04f4ce06..d06110d433 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-postgresql.mdx @@ -83,7 +83,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a data model in your Prisma schema. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database with Prisma ORM](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx index b8a21c5b53..3ac7190407 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection-typescript-sqlserver.mdx @@ -91,7 +91,7 @@ npx prisma db pull This command reads the `DATABASE_URL` environment variable that's defined in `.env` and connects to your database. Once the connection is established, it introspects the database (i.e. it _reads the database schema_). It then translates the database schema from SQL into a Prisma data model. -After the introspection is complete, your Prisma schema file was updated: +After the introspection is complete, your Prisma schema is updated: ![Introspect your database](/img/getting-started/prisma-db-pull-generate-schema.png) diff --git a/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx b/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx index 177fa3a90a..98fdb45de3 100644 --- a/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx +++ b/content/200-orm/050-overview/100-introduction/100-what-is-prisma.mdx @@ -34,7 +34,7 @@ Prisma Client can be used in _any_ Node.js (supported versions) or TypeScript ba ### The Prisma schema -Every project that uses a tool from the Prisma ORM toolkit starts with a [Prisma schema file](/orm/prisma-schema). The Prisma schema allows developers to define their _application models_ in an intuitive data modeling language. It also contains the connection to a database and defines a _generator_: +Every project that uses a tool from the Prisma ORM toolkit starts with a [Prisma schema](/orm/prisma-schema). The Prisma schema allows developers to define their _application models_ in an intuitive data modeling language. It also contains the connection to a database and defines a _generator_: diff --git a/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx b/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx index de96103532..393de9de00 100644 --- a/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx +++ b/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx @@ -182,7 +182,7 @@ Prisma ORM is a **next-generation ORM** that makes working with databases easy f > **Note:** Since Prisma Client is the most prominent tool, we often refer to it as simply Prisma. -The three tools use the [Prisma schema](/orm/prisma-schema) as a single source of truth for the database schema, your application's object schema, and the mapping between the two. It's defined by you and is your main configuration file for Prisma ORM. +The three tools use the [Prisma schema](/orm/prisma-schema) as a single source of truth for the database schema, your application's object schema, and the mapping between the two. It's defined by you and is your main way of configuring Prisma ORM. Prisma ORM makes you productive and confident in the software you're building with features such as _type safety_, rich auto-completion, and a natural API for fetching relations. @@ -440,7 +440,7 @@ In summary, Prisma ORM is a new kind of Data Mapper ORM that differs from tradit Unlike traditional ORMs, with Prisma ORM, you define the Prisma schema – a declarative single source of truth for the database schema and application models. All queries in Prisma Client return plain JavaScript objects which makes the process of interacting with the database a lot more natural as well as more predictable. -Prisma ORM supports two main workflows for starting new projects and adopting in an existing project. For both workflows, the Prisma schema is the main configuration file. +Prisma ORM supports two main workflows for starting new projects and adopting in an existing project. For both workflows, your main avenue for configuration is via the Prisma schema. Like all abstractions, both Prisma ORM and other ORMs hide away some of the underlying details of the database with different assumptions. diff --git a/content/200-orm/050-overview/500-databases/300-postgresql.mdx b/content/200-orm/050-overview/500-databases/300-postgresql.mdx index 340f10e026..dad04752e9 100644 --- a/content/200-orm/050-overview/500-databases/300-postgresql.mdx +++ b/content/200-orm/050-overview/500-databases/300-postgresql.mdx @@ -15,7 +15,7 @@ By default, the PostgreSQL connector contains a database driver responsible for ## Example -To connect to a PostgreSQL database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): +To connect to a PostgreSQL database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/050-overview/500-databases/400-mysql.mdx b/content/200-orm/050-overview/500-databases/400-mysql.mdx index 68f7b01ab2..6cd4bab235 100644 --- a/content/200-orm/050-overview/500-databases/400-mysql.mdx +++ b/content/200-orm/050-overview/500-databases/400-mysql.mdx @@ -15,7 +15,7 @@ By default, the MySQL connector contains a database driver responsible for conne ## Example -To connect to a MySQL database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): +To connect to a MySQL database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/050-overview/500-databases/500-sqlite.mdx b/content/200-orm/050-overview/500-databases/500-sqlite.mdx index 83ccbff260..9e8dd99f9a 100644 --- a/content/200-orm/050-overview/500-databases/500-sqlite.mdx +++ b/content/200-orm/050-overview/500-databases/500-sqlite.mdx @@ -15,7 +15,7 @@ By default, the SQLite connector contains a database driver responsible for conn ## Example -To connect to a SQLite database file, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [schema file](/orm/prisma-schema): +To connect to a SQLite database file, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/050-overview/500-databases/600-mongodb.mdx b/content/200-orm/050-overview/500-databases/600-mongodb.mdx index 070e7ae9bf..dc41f9339b 100644 --- a/content/200-orm/050-overview/500-databases/600-mongodb.mdx +++ b/content/200-orm/050-overview/500-databases/600-mongodb.mdx @@ -33,11 +33,11 @@ Some aspects of using Prisma ORM with MongoDB are the same as when using Prisma - connect to your database, using the [`mongodb` database connector](/orm/overview/databases) - use [Introspection](/orm/prisma-schema/introspection) for existing projects if you already have a MongoDB database - use [`db push`](/orm/prisma-migrate/workflows/prototyping-your-schema) to push changes in your schema to the database -- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma Schema +- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma schema ## Differences to consider -MongoDB's document-based structure and flexible schemas means that using Prisma ORM with MongoDB differs from using it with a relational database in a number of ways. These are some areas where there are differences that you need to be aware of: +MongoDB's document-based structure and flexible schema means that using Prisma ORM with MongoDB differs from using it with a relational database in a number of ways. These are some areas where there are differences that you need to be aware of: - **Defining IDs**: MongoDB documents have an `_id` field (that often contains an [ObjectID](https://www.mongodb.com/docs/manual/reference/bson-types/#std-label-objectid)). Prisma ORM does not support fields starting with `_`, so this needs to be mapped to a Prisma ORM field using the `@map` attribute. For more information, see [Defining IDs in MongoDB](/orm/prisma-schema/data-model/models#defining-ids-in-mongodb). @@ -55,7 +55,7 @@ This section provides instructions for how to carry out tasks that require steps ### How to migrate existing data to match your Prisma schema -Migrating your database over time is an important part of the development cycle. During development, you will need to update your Prisma schema file (for example, to add new fields), then update the data in your development environment’s database, and eventually push both the updated schema and the new data to the production database. +Migrating your database over time is an important part of the development cycle. During development, you will need to update your Prisma schema (for example, to add new fields), then update the data in your development environment’s database, and eventually push both the updated schema and the new data to the production database. @@ -127,7 +127,7 @@ As an example, take a MongoDB database with two collections, `User` and `Post`. - `title` field with a type of `string` - `userId` with a type of `objectID` -On introspection with `db pull`, this is pulled in to the Prisma schema file as follows: +On introspection with `db pull`, this is pulled in to the Prisma schema as follows: ```prisma file=prisma/schema.prisma showLineNumbers model Post { @@ -356,7 +356,7 @@ For more information on how to set up and manage a MongoDB database, see the [Pr ## Example -To connect to a MongoDB server, configure the [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): +To connect to a MongoDB server, configure the [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx b/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx index 5e64df24db..d7969841ec 100644 --- a/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx +++ b/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx @@ -14,7 +14,7 @@ The Microsoft SQL Server data source connector connects Prisma ORM to a [Microso ## Example -To connect to a Microsoft SQL Server database, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): +To connect to a Microsoft SQL Server database, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx index c433d1c827..1d6b8e203c 100644 --- a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx +++ b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx @@ -33,7 +33,7 @@ CockroachDB is largely compatible with PostgreSQL, and can mostly be used with P - connect to your database, using Prisma ORM's [`cockroachdb` database connector](/orm/overview/databases/cockroachdb) - use [Introspection](/orm/prisma-schema/introspection) for existing projects if you already have a CockroachDB database - use [Prisma Migrate](/orm/prisma-migrate) to migrate your database schema to a new version -- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma Schema +- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma schema ## Differences to consider @@ -62,7 +62,7 @@ CREATE TABLE public."Post" ( ); ``` -After introspecting your database with `npx prisma db pull`, you will have a new `Post` model in your `schema.prisma` file: +After introspecting your database with `npx prisma db pull`, you will have a new `Post` model in your Prisma schema: ```prisma file=schema.prisma showLineNumbers model Post { @@ -94,7 +94,7 @@ For more information on generating database keys, see CockroachDB's [Primary key ## Example -To connect to a CockroachDB database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema file](/orm/prisma-schema): +To connect to a CockroachDB database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { diff --git a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx index 8c1b49686f..55ef935025 100644 --- a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx @@ -73,7 +73,7 @@ The following is a list of community created generators. If you want to create y - [`typegraphql-prisma-nestjs`](https://github.com/EndyKaufman/typegraphql-prisma-nestjs#readme): Fork of [`typegraphql-prisma`](https://github.com/MichalLytek/typegraphql-prisma), which also generates CRUD resolvers for Prisma models but for NestJS - [`prisma-typegraphql-types-gen`](https://github.com/YassinEldeeb/prisma-tgql-types-gen): Generates [TypeGraphQL](https://typegraphql.com/) class types and enums from your prisma type definitions, the generated output can be edited without being overwritten by the next gen and has the ability to correct you when you mess up the types with your edits. - [`nexus-prisma`](https://github.com/prisma/nexus-prisma/): Allows to project Prisma models to GraphQL via [GraphQL Nexus](https://nexusjs.org/docs/) -- [`prisma-nestjs-graphql`](https://github.com/unlight/prisma-nestjs-graphql): Generates object types, inputs, args, etc. from the Prisma schema file for usage with `@nestjs/graphql` module +- [`prisma-nestjs-graphql`](https://github.com/unlight/prisma-nestjs-graphql): Generates object types, inputs, args, etc. from the Prisma schema for usage with `@nestjs/graphql` module - [`prisma-appsync`](https://github.com/maoosi/prisma-appsync): Generates a full-blown GraphQL API for [AWS AppSync](https://aws.amazon.com/appsync/) - [`prisma-kysely`](https://github.com/valtyr/prisma-kysely): Generates type definitions for Kysely, a TypeScript SQL query builder. This can be useful to perform queries against your database from an edge runtime, or to write more complex SQL queries not possible in Prisma without dropping type safety. - [`prisma-generator-nestjs-dto`](https://github.com/vegardit/prisma-generator-nestjs-dto): Generates DTO and Entity classes with relation `connect` and `create` options for use with [NestJS Resources](https://docs.nestjs.com/recipes/crud-generator) and [@nestjs/swagger](https://www.npmjs.com/package/@nestjs/swagger) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index d58d768f03..a6bc7ed826 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -1,31 +1,33 @@ --- title: 'Overview' metaTitle: 'Prisma Schema Overview' -metaDescription: 'The Prisma schema is the main configuration file when using Prisma. It is typically called schema.prisma and contains your database connection and data model.' +metaDescription: 'The Prisma schema is the main method of configuration when using Prisma. It is typically called schema.prisma and contains your database connection and data model.' --- - - -The Prisma schema file (short: _schema file_, _Prisma schema_ or _schema_) is the main configuration file for your Prisma ORM setup. It is typically called `schema.prisma` and consists of the following parts: +The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It is typically a single file called `schema.prisma` and consists of the following parts: - [**Data sources**](/orm/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database) - [**Generators**](/orm/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client) - [**Data model definition**](/orm/prisma-schema/data-model): Specifies your application [models](/orm/prisma-schema/data-model/models#defining-models) (the shape of the data per data source) and their [relations](/orm/prisma-schema/data-model/relations) +:::note + +Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) in Prisma ORM 5.15.0 and later. + +::: + See the [Prisma schema API reference](/orm/reference/prisma-schema-reference) for detailed information about each section of the schema. -Whenever a `prisma` command is invoked, the CLI typically reads some information from the schema file, e.g.: +Whenever a `prisma` command is invoked, the CLI typically reads some information from the schema, e.g.: - `prisma generate`: Reads _all_ above mentioned information from the Prisma schema to generate the correct data source client code (e.g. Prisma Client). - `prisma migrate dev`: Reads the data sources and data model definition to create a new migration. -You can also [use environment variables](#accessing-environment-variables-from-the-schema) inside the schema file to provide configuration options when a CLI command is invoked. - - +You can also [use environment variables](#accessing-environment-variables-from-the-schema) inside the schema to provide configuration options when a CLI command is invoked. ## Example -The following is an example of a Prisma schema file that specifies: +The following is an example of a Prisma schema that specifies: - A data source (PostgreSQL or MongoDB) - A generator (Prisma Client) @@ -113,17 +115,23 @@ enum Role { ## Naming -The default name for the schema file is `schema.prisma`. When your schema file is named like this, the Prisma CLI will detect it automatically in the directory where you invoke the CLI command (or any of its subdirectories). +The default name for the schema is `schema.prisma`. When your schema is named like this, the Prisma CLI will detect it automatically in the directory where you invoke the CLI command (or any of its subdirectories). -If the file is named differently, you can provide the `--schema` argument to the Prisma CLI with the path to the schema file, e.g.: +If the file is named differently, you can provide the `--schema` argument to the Prisma CLI with the path to a schema file, e.g.: ``` prisma generate --schema ./database/myschema.prisma ``` +:::note + +If you are using the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) any files in the `prisma/schema` directory are detected automatically. + +::: + ## Syntax -The schema file is written in Prisma Schema Language (PSL). +Prisma schema files are written in Prisma Schema Language (PSL). ### VS Code @@ -144,9 +152,9 @@ model User { ``` ```` -## Prisma schema file location +## Prisma schema location -The Prisma CLI looks for the Prisma schema file in the following locations, in the following order: +The Prisma CLI looks for the Prisma schema in the following locations, in the following order: 1. The location specified by the [`--schema` flag](/orm/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`: @@ -167,7 +175,7 @@ The Prisma CLI looks for the Prisma schema file in the following locations, in t - `./prisma/schema.prisma` - `./schema.prisma` -The Prisma CLI outputs the path of the schema file that will be used. The following example shows the terminal output for `prisma db pull`: +The Prisma CLI outputs the path of the schema that will be used. The following example shows the terminal output for `prisma db pull`: ```no-lines Environment variables loaded from .env @@ -185,7 +193,7 @@ Run prisma generate to generate Prisma Client. You can use environment variables to provide configuration options when a CLI command is invoked, or a Prisma Client query is run. -Hardcoding URLs directly in your schema is possible but is discouraged because it poses a security risk. Using environment variables in the schema allows you to **keep secrets out of the schema file** which in turn **improves the portability of the schema** by allowing you to use it in different environments. +Hardcoding URLs directly in your schema is possible but is discouraged because it poses a security risk. Using environment variables in the schema allows you to **keep secrets out of the schema** which in turn **improves the portability of the schema** by allowing you to use it in different environments. Environment variables can be accessed using the `env()` function: @@ -205,10 +213,10 @@ See [Environment variables](/orm/more/development-environment/environment-variab ## Comments -There are two types of comments that are supported in the schema file: +There are two types of comments that are supported in Prisma schema files: -- `// comment`: This comment is for the reader's clarity and is not present in the abstract syntax tree (AST) of the schema file. -- `/// comment`: These comments will show up in the abstract syntax tree (AST) of the schema file as descriptions to AST nodes. Tools can then use these comments to provide additional information. All comments are attached to the next available node - [free-floating comments](https://github.com/prisma/prisma/issues/3544) are not supported and are not included in the AST. +- `// comment`: This comment is for the reader's clarity and is not present in the abstract syntax tree (AST) of the schema. +- `/// comment`: These comments will show up in the abstract syntax tree (AST) of the schema as descriptions to AST nodes. Tools can then use these comments to provide additional information. All comments are attached to the next available node - [free-floating comments](https://github.com/prisma/prisma/issues/3544) are not supported and are not included in the AST. Here are some different examples: diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index 1be3ef9844..f512a7f8ac 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -28,7 +28,7 @@ The `views` preview feature allows you to represent views in your Prisma schema ## Enable the `views` preview feature -Support for views is currently in an early preview. To enable the `views` preview feature, add the `views` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema file: +Support for views is currently in an early preview. To enable the `views` preview feature, add the `views` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx b/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx index 2561116c77..5585142dfa 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx @@ -15,7 +15,7 @@ Multiple database schema support is currently available with the PostgreSQL, Coc Many database providers allow you to organize database tables into named groups. You can use this to make the logical structure of the data model easier to understand, or to avoid naming collisions between tables. -In PostgreSQL, CockroachDB, and SQL Server, these groups are known as schemas. We will refer to them as _database schemas_ to distinguish them from Prisma ORM's own schema file. +In PostgreSQL, CockroachDB, and SQL Server, these groups are known as schemas. We will refer to them as _database schemas_ to distinguish them from Prisma ORM's own schema. This guide explains how to: @@ -28,7 +28,7 @@ This guide explains how to: ## How to enable the `multiSchema` preview feature -Multi-schema support is currently in preview. To enable the `multiSchema` preview feature, add the `multiSchema` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema file: +Multi-schema support is currently in preview. To enable the `multiSchema` preview feature, add the `multiSchema` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx new file mode 100644 index 0000000000..1a45e5cf9a --- /dev/null +++ b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx @@ -0,0 +1,71 @@ +--- +title: Multi-file Prisma schema +metaTitle: Prisma schema with multiple files +metaDescription: Learn how to split your Prisma schema into multiple files. +--- + +:::tip + +Multi-file Prisma schema is available via the `prismaSchemaFolder` preview feature in Prisma versions 5.15.0 and later. + +::: + +## How to enable multi-file Prisma schema support + +Multiple Prisma schema file support 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: + +```prisma file=schema.prisma showLineNumbers +generator client { + provider = "prisma-client-js" + //add-next-line + previewFeatures = ["prismaSchemaFolder"] +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} +``` + +## How to include multiple Prisma schema files in your project + +To use multiple Prisma schema files, add a `schema` inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. + +## How to use existing Prisma CLI commands with multiple Prisma schema files + +Existing Prisma CLI commands have been updated to support multiple Prisma files. Simply replace references to a file with a directory. As an example, the following `prisma migrate diff` command: + +```terminal +npx prisma migrate diff \ +--from-empty \ +--to-schema-datamodel prisma/schema.prisma \ +--script > prisma/migrations/0_init/migration.sql +``` + +becomes the following: + +```terminal +npx prisma migrate diff \ +--from-empty \ +//highlight-next-line +--to-schema-datamodel prisma/schema \ +--script > prisma/migrations/0_init/migration.sql +``` + +## Best practices + +We’ve found that a few best practices work well with this new feature and will help you get the most out of it: + +1. Organize your files by domain: group related models into the same file. For example, keep all user-related models in `user.prisma` while post-related models go in `post.prisma`. Try to avoid having “kitchen sink” schema files. + +1. Use clear naming conventions: schema files should be named clearly and succinctly. Use names like `user.prisma` and `post.prisma` and not `myModels.prisma` or `CommentFeaturesSchema.prisma`. + +1. Have an obvious “main” schema file: while you can now have as many schema files as you want, you’ll still need a place where you define `datasource` and `generator` blocks. We recommend having a single schema file that’s obviously the “main” file so that these blocks are easy to find. `main.prisma`, `schema.prisma`, and `base.prisma` are a few we’ve seen that work well. + +## Examples + +Our fork of [dub by dub.co](https://github.com/prisma/dub) is a great example of a real world project adapted to use multiple Prisma schema files. + +## Learn more about the `prismaSchemaFolder` preview feature + +To learn more about future plans for the `prismaSchemaFolder` preview feature, or to give feedback, refer to [our Github issue](https://github.com/prisma/prisma/issues/1122). diff --git a/content/200-orm/100-prisma-schema/50-introspection.mdx b/content/200-orm/100-prisma-schema/50-introspection.mdx index fea51a3b60..b41d630399 100644 --- a/content/200-orm/100-prisma-schema/50-introspection.mdx +++ b/content/200-orm/100-prisma-schema/50-introspection.mdx @@ -315,7 +315,7 @@ Note that you can rename the [Prisma-ORM level](/orm/prisma-schema/data-model/re ## Introspection with an existing schema -Running `prisma db pull` for relational databases with an existing schema file merges manual changes made to the schema, with changes made in the database. (This functionality has been added for the first time with version 2.6.0.) For MongoDB, Introspection for now is meant to be done only once for the initial data model. Running it repeatedly will lead to loss of custom changes, as the ones listed below. +Running `prisma db pull` for relational databases with an existing Prisma schema merges manual changes made to the schema, with changes made in the database. (This functionality has been added for the first time with version 2.6.0.) For MongoDB, Introspection for now is meant to be done only once for the initial data model. Running it repeatedly will lead to loss of custom changes, as the ones listed below. Introspection for relational databases maintains the following manual changes: @@ -339,7 +339,7 @@ The following properties of the schema are determined by the database: ### Force overwrite -To overwrite manual changes, and generate a schema based solely on the introspected database and ignore any existing schema file, add the `--force` flag to the `db pull` command: +To overwrite manual changes, and generate a schema based solely on the introspected database and ignore any existing Prisma schema, add the `--force` flag to the `db pull` command: ```terminal npx prisma db pull --force diff --git a/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx b/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx index d2e9e9985e..17c169f51f 100644 --- a/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx +++ b/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx @@ -34,7 +34,7 @@ Prisma's `postgresqlExtensions` preview feature allows you to represent PostgreS ## How to enable the `postgresqlExtensions` preview feature -Representing PostgreSQL extensions in your Prisma schema is currently a preview feature. To enable the `postgresqlExtensions` preview feature, you will need to add the `postgresqlExtensions` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema file: +Representing PostgreSQL extensions in your Prisma schema is currently a preview feature. To enable the `postgresqlExtensions` preview feature, you will need to add the `postgresqlExtensions` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx b/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx index 78892025ad..77b2313739 100644 --- a/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/201-serverless/400-deploy-to-aws-lambda.mdx @@ -243,7 +243,7 @@ This plugin will allow you to copy your `schema.prisma` file into your bundled c -Depending on how your application is bundled, you may need to copy the schema file to a location other than `./`. Use the `serverless package` command to package your code locally so you can review where your schema should be put. +Depending on how your application is bundled, you may need to copy the schema to a location other than `./`. Use the `serverless package` command to package your code locally so you can review where your schema should be put. @@ -289,7 +289,7 @@ custom: #### 4. Wrapping up -You can now re-package and re-deploy your application. To do so, run `serverless deploy`. Webpack output will show the schema file being moved with `copy-webpack-plugin`: +You can now re-package and re-deploy your application. To do so, run `serverless deploy`. Webpack output will show the schema being moved with `copy-webpack-plugin`: diff --git a/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/070-migration-histories.mdx b/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/070-migration-histories.mdx index 3a5f210960..3f009f5f67 100644 --- a/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/070-migration-histories.mdx +++ b/content/200-orm/300-prisma-migrate/200-understanding-prisma-migrate/070-migration-histories.mdx @@ -87,4 +87,4 @@ You must commit the entire `prisma/migrations` folder to source control. This in Source-controlling the `schema.prisma` file is not enough - you must include your migration history. This is because: - As you start to [customize migrations](/orm/prisma-migrate/workflows/development-and-production#customizing-migrations), your migration history contains **information that cannot be represented in the Prisma schema**. For example, you can customize a migration to mitigate data loss that would be caused by a breaking change. -- The `prisma migrate deploy` command, which is used to deploy changes to staging, testing, and production environments, _only_ runs migration files. It does not use the Prisma schema file to fetch the models. +- The `prisma migrate deploy` command, which is used to deploy changes to staging, testing, and production environments, _only_ runs migration files. It does not use the Prisma schema to fetch the models. diff --git a/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx b/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx index 12cbaef527..05da0817fa 100644 --- a/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx +++ b/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx @@ -203,9 +203,9 @@ Your `schema.prisma` and local database now include your team's changes, and the You should commit the following files to source control: - The contents of the `.prisma/migrations` folder, including the `migration_lock.toml` file -- The Prisma schema file (`schema.prisma`) +- The Prisma schema (`schema.prisma`) Source-controlling the `schema.prisma` file is not enough - you must include your migration history. This is because: - As you start to [customize migrations](/orm/prisma-migrate/workflows/customizing-migrations), your migration history contains **information that cannot be represented in the Prisma schema**. For example, you can customize a migration to mitigate data loss that would be caused by a breaking change. -- The `prisma migrate deploy` command, which is used to deploy changes to staging, testing, and production environments, _only_ runs migration files. Prisma Migrate only uses the schema file to read the `url` and `provider` fields, not models and fields. +- The `prisma migrate deploy` command, which is used to deploy changes to staging, testing, and production environments, _only_ runs migration files. Prisma Migrate only uses the schema to read the `url` and `provider` fields, not models and fields. diff --git a/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx b/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx index 52bd3faf85..a84388c722 100644 --- a/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx +++ b/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx @@ -41,7 +41,7 @@ In earlier versions of Prisma ORM, you must instead add a SQL command to your mi ## How to install a PostgreSQL extension as part of a migration -This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma schema file with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/orm/prisma-schema/postgresql-extensions#how-to-migrate-postgresql-extensions). +This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma schema with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/orm/prisma-schema/postgresql-extensions#how-to-migrate-postgresql-extensions). The following example demonstrates how to install the `pgcrypto` extension as part of a migration: diff --git a/content/200-orm/500-reference/200-prisma-cli-reference.mdx b/content/200-orm/500-reference/200-prisma-cli-reference.mdx index bd173475dc..a32b58f5f9 100644 --- a/content/200-orm/500-reference/200-prisma-cli-reference.mdx +++ b/content/200-orm/500-reference/200-prisma-cli-reference.mdx @@ -320,7 +320,7 @@ The `generate` command is most often used to generate Prisma Client with the `pr 1. Searches the current directory and parent directories to find the applicable `npm` project. It will create a `package.json` file in the current directory if it cannot find one. 2. Installs the `@prisma/client` into the `npm` project if it is not already present. -3. Inspects the current directory to find a Prisma schema file to process. It will then generate a customized [Prisma Client](https://github.com/prisma/prisma-client-js) for your project. +3. Inspects the current directory to find a Prisma schema to process. It will then generate a customized [Prisma Client](https://github.com/prisma/prisma-client-js) for your project. #### Prerequisites @@ -850,7 +850,7 @@ model Profile { ### `db push` -The `db push` command pushes the state of your Prisma schema file to the database without using migrations. It creates the database if the database does not exist. +The `db push` command pushes the state of your Prisma schema to the database without using migrations. It creates the database if the database does not exist. This command is a good choice when you do not need to version schema changes, such as during prototyping and local development. diff --git a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx index 37869a7654..27869d05a4 100644 --- a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx +++ b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx @@ -30,6 +30,7 @@ The following [Preview](/orm/more/releases#preview) feature flags are available | `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) | | `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) | | `omitApi` | [5.13.0](https://github.com/prisma/prisma/releases/tag/5.13.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/23924) | +| `prismaSchemaFolder` | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/23924) | To enable a Preview feature, [add the feature flag to the `generator` block](#enabling-a-prisma-client-preview-feature) in your `schema.prisma` file. [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108). diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx index 3ecbc72dec..baeeb1e520 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/600-upgrading-to-prisma-5/index.mdx @@ -146,7 +146,7 @@ If you were using [native database types](/orm/reference/prisma-schema-reference 1. Backup your existing `schema.prisma` file (e.g. use version control) 2. Update your `datasource` provider from `postgresql` to `cockroachdb` -3. Use `npx prisma db pull --force` in order to overwrite your existing Prisma schema file (including native types) to those that are on your CockroachDB instance. +3. Use `npx prisma db pull --force` in order to overwrite your existing Prisma schema (including native types) to those that are on your CockroachDB instance. 4. Review changes between your Prisma schema backup and the new Prisma schema generated by `db pull`. You can either use the new schema as is, or update it to include your preferred spacing, comments, etc. 5. Delete your existing migrations. We will be [performing a baseline](/getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-cockroachdb) in order to make your local setup agree with your existing CockroachDB instance. 6. Perform the [baselining steps](/getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-cockroachdb). After these steps, you'll have migrated successfully from the `postgresql` provider to the `cockroachdb` provider! diff --git a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx index 82a919ae29..fb32510a44 100644 --- a/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/700-upgrading-to-prisma-4.mdx @@ -81,7 +81,7 @@ For more details, see the [Upgrading from previous versions](/orm/prisma-schema/ #### Scalar list defaults -For database connectors that support scalar lists (PostgreSQL, CockroachDB and MongoDB), Prisma ORM 4 introduces the ability to set a default value in your Prisma schema file with the `@default` attribute: +For database connectors that support scalar lists (PostgreSQL, CockroachDB and MongoDB), Prisma ORM 4 introduces the ability to set a default value in your Prisma schema with the `@default` attribute: diff --git a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-mysql.mdx b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-mysql.mdx index 3f6cf10169..56d334d6db 100644 --- a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-mysql.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-mysql.mdx @@ -136,7 +136,7 @@ https://pris.ly/d/getting-started The command created a new folder called `prisma`, and two files: -- `prisma/schema.prisma`: Your Prisma schema file that specifies the [data source](/orm/prisma-schema/overview/data-sources), [generator](/orm/prisma-schema/overview/generators) and [data model](/orm/prisma-schema/data-model/models) (note that the data model doesn't exist yet, it will be generated via introspection). +- `prisma/schema.prisma`: Your Prisma schema that specifies the [data source](/orm/prisma-schema/overview/data-sources), [generator](/orm/prisma-schema/overview/generators) and [data model](/orm/prisma-schema/data-model/models) (note that the data model doesn't exist yet, it will be generated via introspection). - `.env`: A [dotenv](https://github.com/motdotla/dotenv#readme) file to configure your database [connection URL](/orm/reference/connection-urls). Your initial Prisma schema looks as follows: diff --git a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-postgresql.mdx b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-postgresql.mdx index dd86b69dcc..b1432185ed 100644 --- a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-postgresql.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/03-upgrading-the-prisma-layer-postgresql.mdx @@ -135,7 +135,7 @@ https://pris.ly/d/getting-started The command created a new folder called `prisma`, and two files: -- `prisma/schema.prisma`: Your Prisma schema file that specifies the [data source](/orm/prisma-schema/overview/data-sources), [generator](/orm/prisma-schema/overview/generators) and [data model](/orm/prisma-schema/data-model/models) (note that the data model doesn't exist yet, it will be generated via introspection). +- `prisma/schema.prisma`: Your Prisma schema that specifies the [data source](/orm/prisma-schema/overview/data-sources), [generator](/orm/prisma-schema/overview/generators) and [data model](/orm/prisma-schema/data-model/models) (note that the data model doesn't exist yet, it will be generated via introspection). - `.env`: A [dotenv](https://github.com/motdotla/dotenv#readme) file to configure your database [connection URL](/orm/reference/connection-urls). Your initial Prisma schema looks as follows: diff --git a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx index b619bc2f6f..6ed1a5cd98 100644 --- a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx @@ -400,7 +400,7 @@ export const schema = makeSchema({ }) ``` -You can view the current version of your GraphQL schema in SDL in the generated GraphQL schema file in `./schema.graphql`. +You can view the current version of your GraphQL schema in SDL in the generated GraphQL schema in `./schema.graphql`. ## 3. Migrate GraphQL operations diff --git a/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx b/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx index fd9b267c5b..94893f5df5 100644 --- a/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx +++ b/content/200-orm/800-more/450-migrating-to-prisma/01-migrate-from-typeorm.mdx @@ -260,10 +260,10 @@ npx prisma init This command created a new directory called `prisma` with the following files for you: -- `schema.prisma`: Your Prisma schema file that specifies your database connection and models +- `schema.prisma`: Your Prisma schema that specifies your database connection and models - `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) to configure your database connection URL as an environment variable -The Prisma schema file currently looks as follows: +The Prisma schema currently looks as follows: ```prisma file=prisma/schema.prisma showLineNumbers // This is your Prisma schema file, diff --git a/content/200-orm/800-more/450-migrating-to-prisma/02-migrate-from-sequelize.mdx b/content/200-orm/800-more/450-migrating-to-prisma/02-migrate-from-sequelize.mdx index df91ff2be5..3de007b931 100644 --- a/content/200-orm/800-more/450-migrating-to-prisma/02-migrate-from-sequelize.mdx +++ b/content/200-orm/800-more/450-migrating-to-prisma/02-migrate-from-sequelize.mdx @@ -190,10 +190,10 @@ npx prisma init This command created a new directory called `prisma` with the following files for you: -- `schema.prisma`: Your Prisma schema file that specifies your database connection and models +- `schema.prisma`: Your Prisma schema that specifies your database connection and models - `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) to configure your database connection URL as an environment variable -The Prisma schema file currently looks as follows: +The Prisma schema currently looks as follows: ```prisma file=prisma/schema.prisma showLineNumbers // This is your Prisma schema file, diff --git a/content/200-orm/800-more/450-migrating-to-prisma/03-migrate-from-mongoose.mdx b/content/200-orm/800-more/450-migrating-to-prisma/03-migrate-from-mongoose.mdx index 3188962a7f..7ea5285637 100644 --- a/content/200-orm/800-more/450-migrating-to-prisma/03-migrate-from-mongoose.mdx +++ b/content/200-orm/800-more/450-migrating-to-prisma/03-migrate-from-mongoose.mdx @@ -167,10 +167,10 @@ npx prisma init --datasource-provider mongodb This command creates: -- A new directory called `prisma` that contains a `schema.prisma` file; your Prisma schema file specifies your database connection and models +- A new directory called `prisma` that contains a `schema.prisma` file; your Prisma schema specifies your database connection and models - `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) file at the root of your project (if it doesn't already exist), used to configure your database connection URL as an environment variable -The Prisma schema file currently looks as follows: +The Prisma schema currently looks as follows: ```prisma file=prisma/schema.prisma showLineNumbers // This is your Prisma schema file, diff --git a/content/200-orm/800-more/450-migrating-to-prisma/04-migrate-from-drizzle.mdx b/content/200-orm/800-more/450-migrating-to-prisma/04-migrate-from-drizzle.mdx index 8e63bd4acb..8b78db1985 100644 --- a/content/200-orm/800-more/450-migrating-to-prisma/04-migrate-from-drizzle.mdx +++ b/content/200-orm/800-more/450-migrating-to-prisma/04-migrate-from-drizzle.mdx @@ -48,7 +48,7 @@ npx prisma init This command created a new directory called `prisma` with the following files for you: -- `schema.prisma`: Your Prisma schema file that specifies your database connection and models +- `schema.prisma`: Your Prisma schema that specifies your database connection and models - `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) to configure your database connection URL as an environment variable :::note @@ -57,7 +57,7 @@ you may already have a `.env` file. If so, the `prisma init` command will append ::: -The Prisma schema file currently looks as follows: +The Prisma schema currently looks as follows: ```prisma file=prisma/schema.prisma showLineNumbers // This is your Prisma schema file, diff --git a/content/200-orm/800-more/500-development-environment/050-environment-variables/040-env-files.mdx b/content/200-orm/800-more/500-development-environment/050-environment-variables/040-env-files.mdx index 17b3f82e7d..0bf334fc1f 100644 --- a/content/200-orm/800-more/500-development-environment/050-environment-variables/040-env-files.mdx +++ b/content/200-orm/800-more/500-development-environment/050-environment-variables/040-env-files.mdx @@ -31,7 +31,7 @@ We suggest to move the contents of prisma/.env to .env to consolidate your env v The following table describes where the Prisma CLI looks for the `.env` file: -| **Command** | **Schema file location** | **`.env` file locations checked, in order** | +| **Command** | **schema location** | **`.env` file locations checked, in order** | | :---------------------------------------------- | :--------------------------------------------------------------------------- | :-------------------------------------------------------- | | `prisma [command]` | `./prisma/schema.prisma` | `./.env`
`./prisma/.env` | | `prisma [command] --schema=./a/b/schema.prisma` | `./a/b/schema.prisma` | `./.env`
`./a/b/.env`
`./prisma/.env` | diff --git a/docusaurus.config.ts b/docusaurus.config.ts index fcf037a5d9..ecfd394b58 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -40,7 +40,7 @@ const config: Config = { "data-project-logo": "https://www.prisma.io/docs/ai_logo.png", "data-button-text": "Ask AI", "data-modal-example-questions": - "How can I setup relations in my schema file?,What is the difference between the 'migrate dev' and 'db push' commands?,Which cache strategy should I use for my query with Prisma Accelerate?,How can I subscribe to database events with Prisma Pulse?", + "How can I setup relations in my Prisma schema?,What is the difference between the 'migrate dev' and 'db push' commands?,Which cache strategy should I use for my query with Prisma Accelerate?,How can I subscribe to database events with Prisma Pulse?", "data-button-image": "https://www.prisma.io/docs/ai_button.svg", "data-button-width": "64px", "data-button-height": "64px", From 42dc2807806171d28a413d0ca2e5ba42190c090e Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:38:59 -0500 Subject: [PATCH 02/18] correct highlighting syntax --- .../100-prisma-schema/10-overview/index.mdx | 2 +- .../20-relations/400-self-relations.mdx | 14 +++++----- .../20-data-model/20-relations/index.mdx | 2 +- .../100-queries/055-pagination.mdx | 26 ++++++++++++------- .../080-null-and-undefined.mdx | 16 ++++++------ .../050-prisma-client-reference.mdx | 6 +++-- .../05-upgrading-prisma-binding-to-nexus.mdx | 4 +-- 7 files changed, 40 insertions(+), 30 deletions(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index a6bc7ed826..95546a8c29 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -180,7 +180,7 @@ The Prisma CLI outputs the path of the schema that will be used. The following e ```no-lines Environment variables loaded from .env //highlight-next-line -|Prisma Schema loaded from prisma/schema.prisma +Prisma Schema loaded from prisma/schema.prisma Introspecting based on datasource defined in prisma/schema.prisma … diff --git a/content/200-orm/100-prisma-schema/20-data-model/20-relations/400-self-relations.mdx b/content/200-orm/100-prisma-schema/20-data-model/20-relations/400-self-relations.mdx index 885b6c9f04..b65ef7bfac 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/20-relations/400-self-relations.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/20-relations/400-self-relations.mdx @@ -78,7 +78,7 @@ model User {
-```prisma highlight=4;normal +```prisma model User { id String @id @default(auto()) @map("_id") @db.ObjectId name String? @@ -97,7 +97,7 @@ Alternatively, you could rewrite this so that `predecessor` is backed by `predec -```prisma highlight=5,6;normal +```prisma model User { id Int @id @default(autoincrement()) name String? @@ -112,7 +112,7 @@ model User { -```prisma highlight=5,6;normal +```prisma model User { id String @id @default(auto()) @map("_id") @db.ObjectId name String? @@ -129,16 +129,18 @@ model User { No matter which side is backed by a foreign key, Prisma Client surfaces both the `predecessor` and `successor` fields: -```ts line-number +```ts showLineNumbers const x = await prisma.user.create({ data: { name: "Bob McBob", -| successor: { + //highlight-next-line + successor: { connect: { id: 2, }, }, -| predecessor: { + //highlight-next-line + predecessor: { connect: { id: 4, }, diff --git a/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx b/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx index 6425dae8c5..a859de22e0 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/20-relations/index.mdx @@ -180,7 +180,7 @@ const getAuthor = await prisma.user.findUnique({ }, include: { //highlight-next-line -| posts: true, // All posts where authorId == 20 + posts: true, // All posts where authorId == 20 }, }); ``` diff --git a/content/200-orm/200-prisma-client/100-queries/055-pagination.mdx b/content/200-orm/200-prisma-client/100-queries/055-pagination.mdx index d18460b664..751317c496 100644 --- a/content/200-orm/200-prisma-client/100-queries/055-pagination.mdx +++ b/content/200-orm/200-prisma-client/100-queries/055-pagination.mdx @@ -81,7 +81,7 @@ The following example returns the first 4 `Post` records that contain the word ` > **Note**: Since this is the first query, there is no cursor to pass in. -```ts line-number +```ts showLineNumbers const firstQueryResults = await prisma.post.findMany({ take: 4, where: { @@ -97,8 +97,10 @@ const firstQueryResults = await prisma.post.findMany({ // Bookmark your location in the result set - in this // case, the ID of the last post in the list of 4. -|const lastPostInResults = firstQueryResults[3] // Remember: zero-based index! :) -|const myCursor = lastPostInResults.id // Example: 29 +//highlight-start +const lastPostInResults = firstQueryResults[3] // Remember: zero-based index! :) +const myCursor = lastPostInResults.id // Example: 29 +//highlight-end ``` The following diagram shows the IDs of the first 4 results - or page 1. The cursor for the next query is **29**: @@ -111,9 +113,11 @@ The second query returns the first 4 `Post` records that contain the word `"Pris const secondQueryResults = await prisma.post.findMany({ take: 4, skip: 1, // Skip the cursor -| cursor: { -| id: myCursor, -| }, + //highlight-start + cursor: { + id: myCursor, + }, + //highlight-end where: { title: { contains: 'Prisma' /* Optional filter */, @@ -184,11 +188,13 @@ const secondQuery = await prisma.post.findMany({ cursor: { id: myCursor, }, -| where: { -| title: { -| contains: 'Prisma' /* Optional filter */, -| }, + //highlight-start + where: { + title: { + contains: 'Prisma' /* Optional filter */, + }, }, + //highlight-end orderBy: { id: 'asc', }, diff --git a/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx b/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx index 36164f533a..4fb1571bbb 100644 --- a/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx +++ b/content/200-orm/200-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx @@ -257,10 +257,10 @@ updateUser: (parent, args, ctx: Context) => { return ctx.prisma.user.update({ where: { id: Number(args.id) }, data: { - //highlight-start -| email: args.authorEmail, // email cannot be null -| name: args.authorName // name set to null - potentially unwanted behavior - //highlight-end + //highlight-start + email: args.authorEmail, // email cannot be null + name: args.authorName // name set to null - potentially unwanted behavior + //highlight-end }, }) }, @@ -273,10 +273,10 @@ updateUser: (parent, args, ctx: Context) => { return ctx.prisma.user.update({ where: { id: Number(args.id) }, data: { - //highlight-start -| email: args.authorEmail != null ? args.authorEmail : undefined, // If null, do nothing -| name: args.authorName != null ? args.authorName : undefined // If null, do nothing - //highlight-end + //highlight-start + email: args.authorEmail != null ? args.authorEmail : undefined, // If null, do nothing + name: args.authorName != null ? args.authorName : undefined // If null, do nothing + //highlight-end }, }) }, diff --git a/content/200-orm/500-reference/050-prisma-client-reference.mdx b/content/200-orm/500-reference/050-prisma-client-reference.mdx index e50b6a7132..b3a3059ba7 100644 --- a/content/200-orm/500-reference/050-prisma-client-reference.mdx +++ b/content/200-orm/500-reference/050-prisma-client-reference.mdx @@ -2879,7 +2879,8 @@ const user = await prisma.profile.create({ data: { bio: 'Hello World', user: { -| create: { email: 'alice@prisma.io' }, + //highlight-next-line + create: { email: 'alice@prisma.io' }, }, }, }) @@ -2942,7 +2943,8 @@ const user = await prisma.user.update({ where: { email: 'alice@prisma.io' }, data: { posts: { -| create: { title: 'Hello World' }, + //highlight-next-line + create: { title: 'Hello World' }, }, }, }) diff --git a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx index 6ed1a5cd98..5cb2e1dcac 100644 --- a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx @@ -576,8 +576,8 @@ Although this code gives probably gives you a type error in your editor, you can ```graphql line-number type Query { -//highlight-next-line -| posts(searchString: String): [Post!]! + //highlight-next-line + posts(searchString: String): [Post!]! users(after: UserWhereUniqueInput, before: UserWhereUniqueInput, first: Int, last: Int, orderBy: Enumerable, skip: Int, where: UserWhereInput): [User!]! } ``` From e9e81759f266a4b8bd82ecf696d2c47f40f42f75 Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:23:15 -0500 Subject: [PATCH 03/18] Apply suggestions from code review Co-authored-by: Jan Piotrowski --- content/200-orm/100-prisma-schema/10-overview/index.mdx | 2 +- .../100-prisma-schema/20-data-model/90-multiple-files.mdx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index 95546a8c29..4c2af85403 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -213,7 +213,7 @@ See [Environment variables](/orm/more/development-environment/environment-variab ## Comments -There are two types of comments that are supported in Prisma schema files: +There are two types of comments that are supported in Prisma Schema Language: - `// comment`: This comment is for the reader's clarity and is not present in the abstract syntax tree (AST) of the schema. - `/// comment`: These comments will show up in the abstract syntax tree (AST) of the schema as descriptions to AST nodes. Tools can then use these comments to provide additional information. All comments are attached to the next available node - [free-floating comments](https://github.com/prisma/prisma/issues/3544) are not supported and are not included in the AST. diff --git a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx index 1a45e5cf9a..e95a5b62b8 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx @@ -64,8 +64,8 @@ We’ve found that a few best practices work well with this new feature and will ## Examples -Our fork of [dub by dub.co](https://github.com/prisma/dub) is a great example of a real world project adapted to use multiple Prisma schema files. +Our fork of [`dub` by dub.co](https://github.com/prisma/dub) is a great example of a real world project adapted to use a multi-file Prisma Schema. ## Learn more about the `prismaSchemaFolder` preview feature -To learn more about future plans for the `prismaSchemaFolder` preview feature, or to give feedback, refer to [our Github issue](https://github.com/prisma/prisma/issues/1122). +To give feedback on the `prismaSchemaFolder` Preview feature, please refer to [our dedicated Github discussion](https://github.com/prisma/prisma/issues/1122). From e8a367be65393e80968f970cf656b0f5a8f3c25a Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:27:55 -0500 Subject: [PATCH 04/18] capitalize correctly in some places --- .../110-relational-databases-node-mysql.mdx | 2 +- .../110-relational-databases-node-planetscale.mdx | 4 ++-- .../110-relational-databases-node-postgresql.mdx | 2 +- .../110-relational-databases-node-sqlserver.mdx | 2 +- .../110-relational-databases-typescript-cockroachdb.mdx | 2 +- .../110-relational-databases-typescript-mysql.mdx | 2 +- .../110-relational-databases-typescript-planetscale.mdx | 2 +- .../110-relational-databases-typescript-postgresql.mdx | 2 +- .../110-relational-databases-typescript-sqlserver.mdx | 2 +- .../100-start-from-scratch/120-mongodb-node-mongodb.mdx | 2 +- .../100-start-from-scratch/120-mongodb-typescript-mongodb.mdx | 2 +- .../120-mongodb/200-install-prisma-client-node-mongodb.mdx | 2 +- docusaurus.config.ts | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx index a8047c5724..a8cfd698dd 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-mysql.mdx @@ -58,7 +58,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx index 622da45074..b21e8cbe2a 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-planetscale.mdx @@ -51,7 +51,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init @@ -59,5 +59,5 @@ npx prisma init This command does two things: -- creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models +- creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma Schema with your database connection variable and schema models - creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection) diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx index 553f40ea32..ccad457431 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-postgresql.mdx @@ -58,7 +58,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx index 6beb9a4e51..3f85d72687 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-sqlserver.mdx @@ -61,7 +61,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx index abd608321d..15508850b6 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx @@ -64,7 +64,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx index 025e6df3a3..d33c7ed2fa 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx @@ -64,7 +64,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx index a5d2dddfb5..4a049f85f0 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx @@ -70,7 +70,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx index a0c411d96c..6e043e6d69 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx @@ -63,7 +63,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx index 11f885f70c..5fd6ea8af1 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx @@ -66,7 +66,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx index 71694ed74f..616ff0bc3e 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx @@ -58,7 +58,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx index e7bf93815c..801d2e02b1 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx @@ -63,7 +63,7 @@ You can now invoke the Prisma CLI by prefixing it with `npx`: npx prisma ``` -Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command: +Next, set up your Prisma ORM project by creating your [Prisma Schema](/orm/prisma-schema) file with the following command: ```terminal copy npx prisma init diff --git a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx index 2ce3219ec9..2fc601295e 100644 --- a/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx +++ b/content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb/200-install-prisma-client-node-mongodb.mdx @@ -18,7 +18,7 @@ To get started with Prisma Client, you need to install the `@prisma/client` pack npm install @prisma/client ``` -The install command invokes `prisma generate` for you which reads your Prisma schema and generates a version of Prisma Client that is _tailored_ to your models. +The install command invokes `prisma generate` for you which reads your Prisma Schema and generates a version of Prisma Client that is _tailored_ to your models. ![Install and generate Prisma Client](/img/getting-started/prisma-client-install-and-generate.png) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index ecfd394b58..47f69ff779 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -40,7 +40,7 @@ const config: Config = { "data-project-logo": "https://www.prisma.io/docs/ai_logo.png", "data-button-text": "Ask AI", "data-modal-example-questions": - "How can I setup relations in my Prisma schema?,What is the difference between the 'migrate dev' and 'db push' commands?,Which cache strategy should I use for my query with Prisma Accelerate?,How can I subscribe to database events with Prisma Pulse?", + "How can I setup relations in my Prisma Schema?,What is the difference between the 'migrate dev' and 'db push' commands?,Which cache strategy should I use for my query with Prisma Accelerate?,How can I subscribe to database events with Prisma Pulse?", "data-button-image": "https://www.prisma.io/docs/ai_button.svg", "data-button-width": "64px", "data-button-height": "64px", From 4a65701856b4c95e72093dd8537a5048c37bc241 Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:48:43 -0500 Subject: [PATCH 05/18] PR feedback --- .../20-data-model/90-multiple-files.mdx | 21 +++++++------------ .../05-upgrading-prisma-binding-to-nexus.mdx | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx index e95a5b62b8..225fcf04ce 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx @@ -6,13 +6,13 @@ metaDescription: Learn how to split your Prisma schema into multiple files. :::tip -Multi-file Prisma schema is available via the `prismaSchemaFolder` preview feature in Prisma versions 5.15.0 and later. +Multi-file Prisma Schema is available via the `prismaSchemaFolder` preview feature in Prisma versions 5.15.0 and later. ::: ## How to enable multi-file Prisma schema support -Multiple Prisma schema file support 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 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: ```prisma file=schema.prisma showLineNumbers generator client { @@ -33,28 +33,21 @@ To use multiple Prisma schema files, add a `schema` inside of your current `pris ## How to use existing Prisma CLI commands with multiple Prisma schema files -Existing Prisma CLI commands have been updated to support multiple Prisma files. Simply replace references to a file with a directory. As an example, the following `prisma migrate diff` command: +For most Prisma CLI commands, no changes will be necessary to work with a multi-file Prisma schema. Only in the specific cases where you need to supply a schema via an option will a command need to be changed. In these cases, simply replace references to a file with a directory. As an example, the following `prisma db push` command: ```terminal -npx prisma migrate diff \ ---from-empty \ ---to-schema-datamodel prisma/schema.prisma \ ---script > prisma/migrations/0_init/migration.sql +npx prisma db push --schema custom/path/to/my/schema.prisma ``` becomes the following: ```terminal -npx prisma migrate diff \ ---from-empty \ -//highlight-next-line ---to-schema-datamodel prisma/schema \ ---script > prisma/migrations/0_init/migration.sql +npx prisma db push --schema custom/path/to/my/schema # note this is now a directory! ``` -## Best practices +## Tips for multi-file Prisma Schema -We’ve found that a few best practices work well with this new feature and will help you get the most out of it: +We’ve found that a few patterns work well with this new feature and will help you get the most out of it: 1. Organize your files by domain: group related models into the same file. For example, keep all user-related models in `user.prisma` while post-related models go in `post.prisma`. Try to avoid having “kitchen sink” schema files. diff --git a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx index 5cb2e1dcac..2aed8dc6ec 100644 --- a/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx +++ b/content/200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/05-upgrading-prisma-binding-to-nexus.mdx @@ -400,7 +400,7 @@ export const schema = makeSchema({ }) ``` -You can view the current version of your GraphQL schema in SDL in the generated GraphQL schema in `./schema.graphql`. +You can view the current version of your GraphQL schema in SDL in the generated GraphQL schema file in `./schema.graphql`. ## 3. Migrate GraphQL operations From 1b7f2b4f8a4bab3f26d36baaeec7d8dfbbc6923c Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:49:10 -0500 Subject: [PATCH 06/18] more PR feedback --- .../300-prisma-in-your-stack/04-is-prisma-an-orm.mdx | 2 +- content/200-orm/050-overview/500-databases/600-mongodb.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx b/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx index 393de9de00..a1229d44bd 100644 --- a/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx +++ b/content/200-orm/050-overview/300-prisma-in-your-stack/04-is-prisma-an-orm.mdx @@ -182,7 +182,7 @@ Prisma ORM is a **next-generation ORM** that makes working with databases easy f > **Note:** Since Prisma Client is the most prominent tool, we often refer to it as simply Prisma. -The three tools use the [Prisma schema](/orm/prisma-schema) as a single source of truth for the database schema, your application's object schema, and the mapping between the two. It's defined by you and is your main way of configuring Prisma ORM. +These three tools use the [Prisma schema](/orm/prisma-schema) as a single source of truth for the database schema, your application's object schema, and the mapping between the two. It's defined by you and is your main way of configuring Prisma ORM. Prisma ORM makes you productive and confident in the software you're building with features such as _type safety_, rich auto-completion, and a natural API for fetching relations. diff --git a/content/200-orm/050-overview/500-databases/600-mongodb.mdx b/content/200-orm/050-overview/500-databases/600-mongodb.mdx index dc41f9339b..a9c927098f 100644 --- a/content/200-orm/050-overview/500-databases/600-mongodb.mdx +++ b/content/200-orm/050-overview/500-databases/600-mongodb.mdx @@ -33,7 +33,7 @@ Some aspects of using Prisma ORM with MongoDB are the same as when using Prisma - connect to your database, using the [`mongodb` database connector](/orm/overview/databases) - use [Introspection](/orm/prisma-schema/introspection) for existing projects if you already have a MongoDB database - use [`db push`](/orm/prisma-migrate/workflows/prototyping-your-schema) to push changes in your schema to the database -- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma schema +- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma Schema ## Differences to consider From ea33384f84a8becbcecf6ffa8ded8d2812c125dc Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Mon, 3 Jun 2024 22:12:36 -0500 Subject: [PATCH 07/18] move Schema location information to one file --- .../100-prisma-schema/10-overview/index.mdx | 53 ---------------- .../20-data-model/10-models.mdx | 2 +- .../90-multiple-files.mdx => 40-location.mdx} | 59 ++++++++++++++++-- .../prisma-schema/relations-intro.png | Bin 36481 -> 0 bytes .../img/orm}/sample-database.png | Bin 5 files changed, 55 insertions(+), 59 deletions(-) rename content/200-orm/100-prisma-schema/{20-data-model/90-multiple-files.mdx => 40-location.mdx} (60%) delete mode 100644 content/200-orm/100-prisma-schema/prisma-schema/relations-intro.png rename {content/200-orm/100-prisma-schema/prisma-schema => static/img/orm}/sample-database.png (100%) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index 4c2af85403..fc71cd26a7 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -113,22 +113,6 @@ enum Role { -## Naming - -The default name for the schema is `schema.prisma`. When your schema is named like this, the Prisma CLI will detect it automatically in the directory where you invoke the CLI command (or any of its subdirectories). - -If the file is named differently, you can provide the `--schema` argument to the Prisma CLI with the path to a schema file, e.g.: - -``` -prisma generate --schema ./database/myschema.prisma -``` - -:::note - -If you are using the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) any files in the `prisma/schema` directory are detected automatically. - -::: - ## Syntax Prisma schema files are written in Prisma Schema Language (PSL). @@ -152,43 +136,6 @@ model User { ``` ```` -## Prisma schema location - -The Prisma CLI looks for the Prisma schema in the following locations, in the following order: - -1. The location specified by the [`--schema` flag](/orm/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`: - - ```terminal - prisma generate --schema=./alternative/schema.prisma - ``` - -2. The location specified in the `package.json` file (version 2.7.0 and later): - - ```json - "prisma": { - "schema": "db/schema.prisma" - } - ``` - -3. Default locations: - - - `./prisma/schema.prisma` - - `./schema.prisma` - -The Prisma CLI outputs the path of the schema that will be used. The following example shows the terminal output for `prisma db pull`: - -```no-lines -Environment variables loaded from .env -//highlight-next-line -Prisma Schema loaded from prisma/schema.prisma - -Introspecting based on datasource defined in prisma/schema.prisma … - -✔ Introspected 4 models and wrote them into prisma/schema.prisma in 239ms - -Run prisma generate to generate Prisma Client. -``` - ## Accessing environment variables from the schema You can use environment variables to provide configuration options when a CLI command is invoked, or a Prisma Client query is run. diff --git a/content/200-orm/100-prisma-schema/20-data-model/10-models.mdx b/content/200-orm/100-prisma-schema/20-data-model/10-models.mdx index 297ca78035..bbde480a0a 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/10-models.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/10-models.mdx @@ -135,7 +135,7 @@ The data model definition is made up of: The corresponding database looks like this: -![](../prisma-schema/sample-database.png) +![](/img/orm/sample-database.png)
diff --git a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx b/content/200-orm/100-prisma-schema/40-location.mdx similarity index 60% rename from content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx rename to content/200-orm/100-prisma-schema/40-location.mdx index 225fcf04ce..7dd4b57c86 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/90-multiple-files.mdx +++ b/content/200-orm/100-prisma-schema/40-location.mdx @@ -1,17 +1,66 @@ --- -title: Multi-file Prisma schema -metaTitle: Prisma schema with multiple files -metaDescription: Learn how to split your Prisma schema into multiple files. +title: Schema Location +metaTitle: Prisma Schema Location and Configuration +metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multi-file schema. --- +## Default Prisma Schema location + +The Prisma CLI looks for the Prisma schema in the following locations, in the following order: + +1. The location specified by the [`--schema` flag](/orm/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`: + + ```terminal + prisma generate --schema=./alternative/schema.prisma + ``` + +2. The location specified in the `package.json` file (version 2.7.0 and later): + + ```json + "prisma": { + "schema": "db/schema.prisma" + } + ``` + +3. Default locations: + + - `./prisma/schema.prisma` + - `./schema.prisma` + +The Prisma CLI outputs the path of the schema that will be used. The following example shows the terminal output for `prisma db pull`: + +```no-lines +Environment variables loaded from .env +//highlight-next-line +Prisma Schema loaded from prisma/schema.prisma + +Introspecting based on datasource defined in prisma/schema.prisma … + +✔ Introspected 4 models and wrote them into prisma/schema.prisma in 239ms + +Run prisma generate to generate Prisma Client. +``` + +## Prisma Schema naming + +The default name for the schema is `schema.prisma`. When your schema is named like this, the Prisma CLI will detect it automatically in the directory where you invoke the CLI command (or any of its subdirectories). + +If the file is named differently, you can provide the `--schema` argument to the Prisma CLI with the path to a schema file, e.g.: + +``` +prisma generate --schema ./database/myschema.prisma +``` + +> If you are using the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) any files in the `prisma/schema` directory are detected automatically. + +## How to enable multi-file Prisma schema support + :::tip Multi-file Prisma Schema is available via the `prismaSchemaFolder` preview feature in Prisma versions 5.15.0 and later. ::: -## 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: ```prisma file=schema.prisma showLineNumbers diff --git a/content/200-orm/100-prisma-schema/prisma-schema/relations-intro.png b/content/200-orm/100-prisma-schema/prisma-schema/relations-intro.png deleted file mode 100644 index 47bb895580ea3e96bbbd7919d5b3ea192f9c0266..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36481 zcmd41Wmr^E_dYyy4V^;|NGLsYHyDJ7f^?12B}huQ)EI#5D2%3 zm=NfRid<3#fs$_D(NKNphqKiwh68kdrz|OgkGD)`G%$Y-OI%l(=Qr)^tx!2z_^5-C;8@#SZikwvf$29 zKd*@~l6&F!g~P;&g`JWFQ94d6;y=bJrdDamK4BWqe& z*=Nn-aE5Z}awgJ59wJEsA2ky6;%UUoT=LGf|pR`(|Gp_(j>gt&;Yf&taNb+jw3hQ@y5Mr&f)tJw8_3SZNT+eD;PROXTjlQ3HCwY5xj_HunN=-0c|FJ$lY9rz{TsS@Jq@_KBo>^OrUJ5pXB~kS3HfYM4q}^Teyh!;QG-*1Z{$)=nCNmCz6Vq z0Fuucfk`%iqA?{YWa2W&-AD2K6g%@l9y(Fl>oH|I2w(#|e``+|hIZDo;3k%A7W2M4 zB&D;!XHNee*8JdE-MkSv#6lWnN{8!Getz&-kjK@16?rM?L%=|Qs_fHNn+h?K{j`AQjO6cmor)4W)wCiL=*Xp4| zHJ$-(O= z%&h+txN1*Ny%8?-+yC|B_*MES{7bp)4^ul#mRaeQE{TVvr{P-exzS>Iopon_Ap_767sqX!tW9T(5f0iEHv z5f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R^rgWfz<|6Di>oFPvLdJYyR_zxrrZX6bc zI!DmmcM*bNl^SE!LtQlpVLsNq8^qcx+iQ!zkA^Ak&t{gdSsJdfdf%45eWUGQrBePt z%m2(e_J}Sqci)|%VC8bf>vm0tjcNlT@$!TdciY{G*MZeD^VYYe4gE$OY9$t$JH!|2 zv7VG(ZDP|~mMi6B@mrON@mq>3WUy~7;&T#f;G~RDCXoIJ)tR`*c(RcJxZoyo*1muh zy$Mxc04bEL=%ViHPcM$?oPllbvVOAua3Ve?Oo~_m$q0X+^ADAIyHG89i4nF7iY8wG wJ;KK3QmYCXuhd*xJf<~=yUr9Dc+Q|3+10qallK=n! diff --git a/content/200-orm/100-prisma-schema/prisma-schema/sample-database.png b/static/img/orm/sample-database.png similarity index 100% rename from content/200-orm/100-prisma-schema/prisma-schema/sample-database.png rename to static/img/orm/sample-database.png From 638b347f70236aa65f70a1c143f63537413d42fd Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 10:05:53 +0000 Subject: [PATCH 08/18] move page and fix links --- .../04-location.mdx} | 14 ++++++++------ .../100-prisma-schema/10-overview/index.mdx | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) rename content/200-orm/100-prisma-schema/{40-location.mdx => 10-overview/04-location.mdx} (91%) diff --git a/content/200-orm/100-prisma-schema/40-location.mdx b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx similarity index 91% rename from content/200-orm/100-prisma-schema/40-location.mdx rename to content/200-orm/100-prisma-schema/10-overview/04-location.mdx index 7dd4b57c86..3c0a231686 100644 --- a/content/200-orm/100-prisma-schema/40-location.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/04-location.mdx @@ -51,9 +51,11 @@ If the file is named differently, you can provide the `--schema` argument to the prisma generate --schema ./database/myschema.prisma ``` -> If you are using the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) any files in the `prisma/schema` directory are detected automatically. +> If you are using the [`prismaSchemaFolder` preview feature](#multi-file-prisma-schema) any files in the `prisma/schema` directory are detected automatically. -## How to enable multi-file Prisma schema support +## Multi-file Prisma Schema + +### How to enable multi-file Prisma schema support :::tip @@ -76,7 +78,7 @@ datasource db { } ``` -## How to include multiple Prisma schema files in your project +### How to include multiple Prisma schema files in your project To use multiple Prisma schema files, add a `schema` inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. @@ -94,7 +96,7 @@ becomes the following: npx prisma db push --schema custom/path/to/my/schema # note this is now a directory! ``` -## Tips for multi-file Prisma Schema +### Tips for multi-file Prisma Schema We’ve found that a few patterns work well with this new feature and will help you get the most out of it: @@ -104,10 +106,10 @@ We’ve found that a few patterns work well with this new feature and will help 1. Have an obvious “main” schema file: while you can now have as many schema files as you want, you’ll still need a place where you define `datasource` and `generator` blocks. We recommend having a single schema file that’s obviously the “main” file so that these blocks are easy to find. `main.prisma`, `schema.prisma`, and `base.prisma` are a few we’ve seen that work well. -## Examples +### Examples Our fork of [`dub` by dub.co](https://github.com/prisma/dub) is a great example of a real world project adapted to use a multi-file Prisma Schema. -## Learn more about the `prismaSchemaFolder` preview feature +### Learn more about the `prismaSchemaFolder` preview feature To give feedback on the `prismaSchemaFolder` Preview feature, please refer to [our dedicated Github discussion](https://github.com/prisma/prisma/issues/1122). diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index fc71cd26a7..6a1ae7a832 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -4,7 +4,7 @@ metaTitle: 'Prisma Schema Overview' metaDescription: 'The Prisma schema is the main method of configuration when using Prisma. It is typically called schema.prisma and contains your database connection and data model.' --- -The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It is typically a single file called `schema.prisma` and consists of the following parts: +The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It is typically a single file called `schema.prisma` (or multiple files with `.prisma` file extension) and consists of the following parts: - [**Data sources**](/orm/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database) - [**Generators**](/orm/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client) @@ -12,7 +12,7 @@ The Prisma schema (or _schema_ for short) is the main method of configuration fo :::note -Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/multiple-files) in Prisma ORM 5.15.0 and later. +Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. ::: From 58fedcd074aec44e2d55e7de1278ae16b9f352d2 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 10:10:23 +0000 Subject: [PATCH 09/18] fix link --- content/200-orm/100-prisma-schema/10-overview/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index 6a1ae7a832..f9b115999d 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -12,7 +12,7 @@ The Prisma schema (or _schema_ for short) is the main method of configuration fo :::note -Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/data-model/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. +Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/overview/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. ::: From 3a90f93ea521de00d8751673351a5442831a99ff Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 10:21:57 +0000 Subject: [PATCH 10/18] Restructure Location page a bit --- .../10-overview/04-location.mdx | 30 +++++++------------ .../100-prisma-schema/10-overview/index.mdx | 6 ++-- 2 files changed, 14 insertions(+), 22 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 3c0a231686..4aaca720b5 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 @@ -4,7 +4,11 @@ metaTitle: Prisma Schema Location and Configuration metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multi-file schema. --- -## Default Prisma Schema location +The default name for the Prisma schema is a single file `schema.prisma` in your `prisma` folder. When your schema is named like this, the Prisma CLI will detect it automatically. + +> If you are using the [`prismaSchemaFolder` preview feature](#multi-file-prisma-schema) any files in the `prisma/schema` directory are detected automatically. + +## Prisma Schema location The Prisma CLI looks for the Prisma schema in the following locations, in the following order: @@ -41,28 +45,18 @@ Introspecting based on datasource defined in prisma/schema.prisma … Run prisma generate to generate Prisma Client. ``` -## Prisma Schema naming - -The default name for the schema is `schema.prisma`. When your schema is named like this, the Prisma CLI will detect it automatically in the directory where you invoke the CLI command (or any of its subdirectories). - -If the file is named differently, you can provide the `--schema` argument to the Prisma CLI with the path to a schema file, e.g.: - -``` -prisma generate --schema ./database/myschema.prisma -``` - -> If you are using the [`prismaSchemaFolder` preview feature](#multi-file-prisma-schema) any files in the `prisma/schema` directory are detected automatically. - ## Multi-file Prisma Schema -### How to enable multi-file Prisma schema support - :::tip Multi-file Prisma Schema is available via the `prismaSchemaFolder` preview feature in Prisma versions 5.15.0 and later. ::: +To use multiple Prisma schema files, add a `schema` folder inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. + +### 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: ```prisma file=schema.prisma showLineNumbers @@ -78,11 +72,7 @@ datasource db { } ``` -### How to include multiple Prisma schema files in your project - -To use multiple Prisma schema files, add a `schema` inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. - -## How to use existing Prisma CLI commands with multiple Prisma schema files +### How to use existing Prisma CLI commands with multiple Prisma schema files For most Prisma CLI commands, no changes will be necessary to work with a multi-file Prisma schema. Only in the specific cases where you need to supply a schema via an option will a command need to be changed. In these cases, simply replace references to a file with a directory. As an example, the following `prisma db push` command: diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index f9b115999d..b4e07c6ff3 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -4,12 +4,14 @@ metaTitle: 'Prisma Schema Overview' metaDescription: 'The Prisma schema is the main method of configuration when using Prisma. It is typically called schema.prisma and contains your database connection and data model.' --- -The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It is typically a single file called `schema.prisma` (or multiple files with `.prisma` file extension) and consists of the following parts: +The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It consists of the following parts: - [**Data sources**](/orm/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database) - [**Generators**](/orm/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client) - [**Data model definition**](/orm/prisma-schema/data-model): Specifies your application [models](/orm/prisma-schema/data-model/models#defining-models) (the shape of the data per data source) and their [relations](/orm/prisma-schema/data-model/relations) +It is typically a single file called `schema.prisma` (or multiple files with `.prisma` file extension) that is stored in a defined but customizable [location](/orm/prisma-schema/overview/location). + :::note Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/overview/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. @@ -115,7 +117,7 @@ enum Role { ## Syntax -Prisma schema files are written in Prisma Schema Language (PSL). +Prisma schema files are written in Prisma Schema Language (PSL). See the [**Data sources**](/orm/prisma-schema/overview/data-sources), [**Generators**](/orm/prisma-schema/overview/generators) and [**Data model definition**](/orm/prisma-schema/data-model) pages for details and examples. ### VS Code From af6372464e5b073398813d8deb5cd726b6c480e6 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 12:30:22 +0200 Subject: [PATCH 11/18] Apply suggestions from code review --- content/200-orm/050-overview/500-databases/600-mongodb.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/200-orm/050-overview/500-databases/600-mongodb.mdx b/content/200-orm/050-overview/500-databases/600-mongodb.mdx index a9c927098f..44dd55c87b 100644 --- a/content/200-orm/050-overview/500-databases/600-mongodb.mdx +++ b/content/200-orm/050-overview/500-databases/600-mongodb.mdx @@ -127,7 +127,7 @@ As an example, take a MongoDB database with two collections, `User` and `Post`. - `title` field with a type of `string` - `userId` with a type of `objectID` -On introspection with `db pull`, this is pulled in to the Prisma schema as follows: +On introspection with `db pull`, this is pulled in to the Prisma Schema as follows: ```prisma file=prisma/schema.prisma showLineNumbers model Post { @@ -356,7 +356,7 @@ For more information on how to set up and manage a MongoDB database, see the [Pr ## Example -To connect to a MongoDB server, configure the [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema): +To connect to a MongoDB server, configure the [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma Schema](/orm/prisma-schema): ```prisma file=schema.prisma showLineNumbers datasource db { From 98aecea67ceac796bd8390633c959bf508b3fd7a Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 10:35:08 +0000 Subject: [PATCH 12/18] syntax fix --- content/200-orm/100-prisma-schema/10-overview/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index b4e07c6ff3..3c8ed75993 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -117,7 +117,7 @@ enum Role { ## Syntax -Prisma schema files are written in Prisma Schema Language (PSL). See the [**Data sources**](/orm/prisma-schema/overview/data-sources), [**Generators**](/orm/prisma-schema/overview/generators) and [**Data model definition**](/orm/prisma-schema/data-model) pages for details and examples. +Prisma schema files are written in Prisma Schema Language (PSL). See the [data sources](/orm/prisma-schema/overview/data-sources), [generators](/orm/prisma-schema/overview/generators), [data model definition**](/orm/prisma-schema/data-model) and of course [Prisma schema API reference](/orm/reference/prisma-schema-reference) pages for details and examples. ### VS Code From 5bf835296fd128c32bcc4c32991d9a45d6503d23 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 10:40:28 +0000 Subject: [PATCH 13/18] change captialization --- 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 4aaca720b5..bcfb536ab7 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 @@ -1,5 +1,5 @@ --- -title: Schema Location +title: Schema location metaTitle: Prisma Schema Location and Configuration metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multi-file schema. --- From 8d23a76197679ab05a65e4843cc0710b13207b44 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 12:57:55 +0200 Subject: [PATCH 14/18] Apply suggestions from code review --- content/200-orm/100-prisma-schema/10-overview/04-location.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 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 bcfb536ab7..97e13987df 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 @@ -1,7 +1,7 @@ --- title: Schema location metaTitle: Prisma Schema Location and Configuration -metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multi-file schema. +metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multiple files. --- The default name for the Prisma schema is a single file `schema.prisma` in your `prisma` folder. When your schema is named like this, the Prisma CLI will detect it automatically. @@ -88,7 +88,7 @@ npx prisma db push --schema custom/path/to/my/schema # note this is now a direc ### Tips for multi-file Prisma Schema -We’ve found that a few patterns work well with this new feature and will help you get the most out of it: +We’ve found that a few patterns work well with this feature and will help you get the most out of it: 1. Organize your files by domain: group related models into the same file. For example, keep all user-related models in `user.prisma` while post-related models go in `post.prisma`. Try to avoid having “kitchen sink” schema files. From 76cd56286caa7ee8d9c476c23cd7718ea30bb432 Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Tue, 4 Jun 2024 06:32:13 -0500 Subject: [PATCH 15/18] Update content/200-orm/100-prisma-schema/10-overview/04-location.mdx --- .../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 97e13987df..fc987f7a00 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 @@ -90,11 +90,11 @@ npx prisma db push --schema custom/path/to/my/schema # note this is now a direc We’ve found that a few patterns work well with this feature and will help you get the most out of it: -1. Organize your files by domain: group related models into the same file. For example, keep all user-related models in `user.prisma` while post-related models go in `post.prisma`. Try to avoid having “kitchen sink” schema files. +* Organize your files by domain: group related models into the same file. For example, keep all user-related models in `user.prisma` while post-related models go in `post.prisma`. Try to avoid having “kitchen sink” schema files. -1. Use clear naming conventions: schema files should be named clearly and succinctly. Use names like `user.prisma` and `post.prisma` and not `myModels.prisma` or `CommentFeaturesSchema.prisma`. +* Use clear naming conventions: schema files should be named clearly and succinctly. Use names like `user.prisma` and `post.prisma` and not `myModels.prisma` or `CommentFeaturesSchema.prisma`. -1. Have an obvious “main” schema file: while you can now have as many schema files as you want, you’ll still need a place where you define `datasource` and `generator` blocks. We recommend having a single schema file that’s obviously the “main” file so that these blocks are easy to find. `main.prisma`, `schema.prisma`, and `base.prisma` are a few we’ve seen that work well. +* Have an obvious “main” schema file: while you can now have as many schema files as you want, you’ll still need a place where you define `datasource` and `generator` blocks. We recommend having a single schema file that’s obviously the “main” file so that these blocks are easy to find. `main.prisma`, `schema.prisma`, and `base.prisma` are a few we’ve seen that work well. ### Examples From c5c85de417345327c52f5963807d9a23642f45ce Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Tue, 4 Jun 2024 07:18:03 -0500 Subject: [PATCH 16/18] Update content/200-orm/100-prisma-schema/10-overview/04-location.mdx --- .../100-prisma-schema/10-overview/04-location.mdx | 10 ++++++++++ 1 file changed, 10 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 fc987f7a00..0d9e8b85e6 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 @@ -54,6 +54,16 @@ Multi-file Prisma Schema is available via the `prismaSchemaFolder` preview featu ::: To use multiple Prisma schema files, add a `schema` folder inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. +``` +my-app/ +├─ ... +├─ prisma/ +│ ├─ schema/ +│ │ ├─ post.prisma +│ │ ├─ schema.prisma +│ │ ├─ user.prisma +├─ ... +``` ### How to enable multi-file Prisma schema support From bc87bb34b14835afce2aa5e3022d55a37e384a6d Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Tue, 4 Jun 2024 08:15:09 -0500 Subject: [PATCH 17/18] Apply suggestions from code review --- .../050-overview/500-databases/840-cockroachdb.mdx | 4 ++-- .../100-prisma-schema/10-overview/03-generators.mdx | 2 +- .../200-orm/100-prisma-schema/10-overview/04-location.mdx | 8 ++++---- content/200-orm/100-prisma-schema/10-overview/index.mdx | 8 ++++---- .../200-orm/100-prisma-schema/20-data-model/40-views.mdx | 2 +- .../100-prisma-schema/20-data-model/60-multi-schema.mdx | 2 +- content/200-orm/100-prisma-schema/50-introspection.mdx | 4 ++-- .../100-prisma-schema/80-postgresql-extensions.mdx | 2 +- .../300-workflows/100-team-development.mdx | 2 +- .../300-workflows/120-native-database-functions.mdx | 2 +- .../200-orm/500-reference/200-prisma-cli-reference.mdx | 2 +- .../500-preview-features/050-client-preview-features.mdx | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx index 1d6b8e203c..076112be0d 100644 --- a/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx +++ b/content/200-orm/050-overview/500-databases/840-cockroachdb.mdx @@ -33,7 +33,7 @@ CockroachDB is largely compatible with PostgreSQL, and can mostly be used with P - connect to your database, using Prisma ORM's [`cockroachdb` database connector](/orm/overview/databases/cockroachdb) - use [Introspection](/orm/prisma-schema/introspection) for existing projects if you already have a CockroachDB database - use [Prisma Migrate](/orm/prisma-migrate) to migrate your database schema to a new version -- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma schema +- use [Prisma Client](/orm/prisma-client) in your application to query your database in a type safe way based on your Prisma Schema ## Differences to consider @@ -62,7 +62,7 @@ CREATE TABLE public."Post" ( ); ``` -After introspecting your database with `npx prisma db pull`, you will have a new `Post` model in your Prisma schema: +After introspecting your database with `npx prisma db pull`, you will have a new `Post` model in your Prisma Schema: ```prisma file=schema.prisma showLineNumbers model Post { diff --git a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx index 55ef935025..878ea626e5 100644 --- a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx @@ -73,7 +73,7 @@ The following is a list of community created generators. If you want to create y - [`typegraphql-prisma-nestjs`](https://github.com/EndyKaufman/typegraphql-prisma-nestjs#readme): Fork of [`typegraphql-prisma`](https://github.com/MichalLytek/typegraphql-prisma), which also generates CRUD resolvers for Prisma models but for NestJS - [`prisma-typegraphql-types-gen`](https://github.com/YassinEldeeb/prisma-tgql-types-gen): Generates [TypeGraphQL](https://typegraphql.com/) class types and enums from your prisma type definitions, the generated output can be edited without being overwritten by the next gen and has the ability to correct you when you mess up the types with your edits. - [`nexus-prisma`](https://github.com/prisma/nexus-prisma/): Allows to project Prisma models to GraphQL via [GraphQL Nexus](https://nexusjs.org/docs/) -- [`prisma-nestjs-graphql`](https://github.com/unlight/prisma-nestjs-graphql): Generates object types, inputs, args, etc. from the Prisma schema for usage with `@nestjs/graphql` module +- [`prisma-nestjs-graphql`](https://github.com/unlight/prisma-nestjs-graphql): Generates object types, inputs, args, etc. from the Prisma Schema for usage with `@nestjs/graphql` module - [`prisma-appsync`](https://github.com/maoosi/prisma-appsync): Generates a full-blown GraphQL API for [AWS AppSync](https://aws.amazon.com/appsync/) - [`prisma-kysely`](https://github.com/valtyr/prisma-kysely): Generates type definitions for Kysely, a TypeScript SQL query builder. This can be useful to perform queries against your database from an edge runtime, or to write more complex SQL queries not possible in Prisma without dropping type safety. - [`prisma-generator-nestjs-dto`](https://github.com/vegardit/prisma-generator-nestjs-dto): Generates DTO and Entity classes with relation `connect` and `create` options for use with [NestJS Resources](https://docs.nestjs.com/recipes/crud-generator) and [@nestjs/swagger](https://www.npmjs.com/package/@nestjs/swagger) 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 0d9e8b85e6..2e5a20b1bc 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 @@ -4,13 +4,13 @@ metaTitle: Prisma Schema Location and Configuration metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multiple files. --- -The default name for the Prisma schema is a single file `schema.prisma` in your `prisma` folder. When your schema is named like this, the Prisma CLI will detect it automatically. +The default name for the Prisma Schema is a single file `schema.prisma` in your `prisma` folder. When your schema is named like this, the Prisma CLI will detect it automatically. > If you are using the [`prismaSchemaFolder` preview feature](#multi-file-prisma-schema) any files in the `prisma/schema` directory are detected automatically. ## Prisma Schema location -The Prisma CLI looks for the Prisma schema in the following locations, in the following order: +The Prisma CLI looks for the Prisma Schema in the following locations, in the following order: 1. The location specified by the [`--schema` flag](/orm/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`: @@ -53,7 +53,7 @@ Multi-file Prisma Schema is available via the `prismaSchemaFolder` preview featu ::: -To use multiple Prisma schema files, add a `schema` folder inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. +To use multiple Prisma Schema files, add a `schema` folder inside of your current `prisma` directory. With the `prismaSchemaFolder` Preview feature enabled, you can add as many files as you want to the `prisma/schema` directory. ``` my-app/ ├─ ... @@ -67,7 +67,7 @@ my-app/ ### 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 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: ```prisma file=schema.prisma showLineNumbers generator client { diff --git a/content/200-orm/100-prisma-schema/10-overview/index.mdx b/content/200-orm/100-prisma-schema/10-overview/index.mdx index 3c8ed75993..970bce8f80 100644 --- a/content/200-orm/100-prisma-schema/10-overview/index.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/index.mdx @@ -4,7 +4,7 @@ metaTitle: 'Prisma Schema Overview' metaDescription: 'The Prisma schema is the main method of configuration when using Prisma. It is typically called schema.prisma and contains your database connection and data model.' --- -The Prisma schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It consists of the following parts: +The Prisma Schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It consists of the following parts: - [**Data sources**](/orm/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database) - [**Generators**](/orm/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client) @@ -14,7 +14,7 @@ It is typically a single file called `schema.prisma` (or multiple files with `.p :::note -Looking to split your schema into multiple files? Multi-file Prisma schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/overview/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. +Looking to split your schema into multiple files? Multi-file Prisma Schema is supported via the [`prismaSchemaFolder` preview feature](/orm/prisma-schema/overview/location#multi-file-prisma-schema) in Prisma ORM 5.15.0 and later. ::: @@ -29,7 +29,7 @@ You can also [use environment variables](#accessing-environment-variables-from-t ## Example -The following is an example of a Prisma schema that specifies: +The following is an example of a Prisma Schema that specifies: - A data source (PostgreSQL or MongoDB) - A generator (Prisma Client) @@ -117,7 +117,7 @@ enum Role { ## Syntax -Prisma schema files are written in Prisma Schema Language (PSL). See the [data sources](/orm/prisma-schema/overview/data-sources), [generators](/orm/prisma-schema/overview/generators), [data model definition**](/orm/prisma-schema/data-model) and of course [Prisma schema API reference](/orm/reference/prisma-schema-reference) pages for details and examples. +Prisma Schema files are written in Prisma Schema Language (PSL). See the [data sources](/orm/prisma-schema/overview/data-sources), [generators](/orm/prisma-schema/overview/generators), [data model definition**](/orm/prisma-schema/data-model) and of course [Prisma Schema API reference](/orm/reference/prisma-schema-reference) pages for details and examples. ### VS Code diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index f512a7f8ac..c8551900ec 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -28,7 +28,7 @@ The `views` preview feature allows you to represent views in your Prisma schema ## Enable the `views` preview feature -Support for views is currently in an early preview. To enable the `views` preview feature, add the `views` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: +Support for views is currently in an early preview. To enable the `views` preview feature, add the `views` feature flag to the `previewFeatures` field of the `generator` block in your Prisma Schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx b/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx index 5585142dfa..af8c523fcc 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/60-multi-schema.mdx @@ -28,7 +28,7 @@ This guide explains how to: ## How to enable the `multiSchema` preview feature -Multi-schema support is currently in preview. To enable the `multiSchema` preview feature, add the `multiSchema` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: +Multi-schema support is currently in preview. To enable the `multiSchema` preview feature, add the `multiSchema` feature flag to the `previewFeatures` field of the `generator` block in your Prisma Schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/100-prisma-schema/50-introspection.mdx b/content/200-orm/100-prisma-schema/50-introspection.mdx index b41d630399..0e76630d80 100644 --- a/content/200-orm/100-prisma-schema/50-introspection.mdx +++ b/content/200-orm/100-prisma-schema/50-introspection.mdx @@ -315,7 +315,7 @@ Note that you can rename the [Prisma-ORM level](/orm/prisma-schema/data-model/re ## Introspection with an existing schema -Running `prisma db pull` for relational databases with an existing Prisma schema merges manual changes made to the schema, with changes made in the database. (This functionality has been added for the first time with version 2.6.0.) For MongoDB, Introspection for now is meant to be done only once for the initial data model. Running it repeatedly will lead to loss of custom changes, as the ones listed below. +Running `prisma db pull` for relational databases with an existing Prisma Schema merges manual changes made to the schema, with changes made in the database. (This functionality has been added for the first time with version 2.6.0.) For MongoDB, Introspection for now is meant to be done only once for the initial data model. Running it repeatedly will lead to loss of custom changes, as the ones listed below. Introspection for relational databases maintains the following manual changes: @@ -339,7 +339,7 @@ The following properties of the schema are determined by the database: ### Force overwrite -To overwrite manual changes, and generate a schema based solely on the introspected database and ignore any existing Prisma schema, add the `--force` flag to the `db pull` command: +To overwrite manual changes, and generate a schema based solely on the introspected database and ignore any existing Prisma Schema, add the `--force` flag to the `db pull` command: ```terminal npx prisma db pull --force diff --git a/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx b/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx index 17c169f51f..e16e95a16c 100644 --- a/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx +++ b/content/200-orm/100-prisma-schema/80-postgresql-extensions.mdx @@ -34,7 +34,7 @@ Prisma's `postgresqlExtensions` preview feature allows you to represent PostgreS ## How to enable the `postgresqlExtensions` preview feature -Representing PostgreSQL extensions in your Prisma schema is currently a preview feature. To enable the `postgresqlExtensions` preview feature, you will need to add the `postgresqlExtensions` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: +Representing PostgreSQL extensions in your Prisma Schema is currently a preview feature. To enable the `postgresqlExtensions` preview feature, you will need to add the `postgresqlExtensions` feature flag to the `previewFeatures` field of the `generator` block in your Prisma schema: ```prisma file=schema.prisma highlight=3;add showLineNumbers generator client { diff --git a/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx b/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx index 05da0817fa..9f6437bee4 100644 --- a/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx +++ b/content/200-orm/300-prisma-migrate/300-workflows/100-team-development.mdx @@ -203,7 +203,7 @@ Your `schema.prisma` and local database now include your team's changes, and the You should commit the following files to source control: - The contents of the `.prisma/migrations` folder, including the `migration_lock.toml` file -- The Prisma schema (`schema.prisma`) +- The Prisma Schema (`schema.prisma`) Source-controlling the `schema.prisma` file is not enough - you must include your migration history. This is because: diff --git a/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx b/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx index a84388c722..f9a6f18728 100644 --- a/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx +++ b/content/200-orm/300-prisma-migrate/300-workflows/120-native-database-functions.mdx @@ -41,7 +41,7 @@ In earlier versions of Prisma ORM, you must instead add a SQL command to your mi ## How to install a PostgreSQL extension as part of a migration -This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma schema with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/orm/prisma-schema/postgresql-extensions#how-to-migrate-postgresql-extensions). +This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma Schema with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/orm/prisma-schema/postgresql-extensions#how-to-migrate-postgresql-extensions). The following example demonstrates how to install the `pgcrypto` extension as part of a migration: diff --git a/content/200-orm/500-reference/200-prisma-cli-reference.mdx b/content/200-orm/500-reference/200-prisma-cli-reference.mdx index a32b58f5f9..dd1a104e42 100644 --- a/content/200-orm/500-reference/200-prisma-cli-reference.mdx +++ b/content/200-orm/500-reference/200-prisma-cli-reference.mdx @@ -320,7 +320,7 @@ The `generate` command is most often used to generate Prisma Client with the `pr 1. Searches the current directory and parent directories to find the applicable `npm` project. It will create a `package.json` file in the current directory if it cannot find one. 2. Installs the `@prisma/client` into the `npm` project if it is not already present. -3. Inspects the current directory to find a Prisma schema to process. It will then generate a customized [Prisma Client](https://github.com/prisma/prisma-client-js) for your project. +3. Inspects the current directory to find a Prisma Schema to process. It will then generate a customized [Prisma Client](https://github.com/prisma/prisma-client-js) for your project. #### Prerequisites diff --git a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx index 27869d05a4..07b96a63cd 100644 --- a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx +++ b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx @@ -30,7 +30,7 @@ The following [Preview](/orm/more/releases#preview) feature flags are available | `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) | | `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) | | `omitApi` | [5.13.0](https://github.com/prisma/prisma/releases/tag/5.13.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/23924) | -| `prismaSchemaFolder` | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/23924) | +| `prismaSchemaFolder` | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/24413) | To enable a Preview feature, [add the feature flag to the `generator` block](#enabling-a-prisma-client-preview-feature) in your `schema.prisma` file. [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108). From e19297dc30143d833cf474952ab39049a4259aaa Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 4 Jun 2024 15:40:26 +0200 Subject: [PATCH 18/18] Update content/200-orm/100-prisma-schema/10-overview/04-location.mdx --- 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 2e5a20b1bc..a2cbdcb400 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 @@ -112,4 +112,4 @@ Our fork of [`dub` by dub.co](https://github.com/prisma/dub) is a great example ### Learn more about the `prismaSchemaFolder` preview feature -To give feedback on the `prismaSchemaFolder` Preview feature, please refer to [our dedicated Github discussion](https://github.com/prisma/prisma/issues/1122). +To give feedback on the `prismaSchemaFolder` Preview feature, please refer to [our dedicated Github discussion](https://github.com/prisma/prisma/discussions/24413).