diff --git a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx index 9f20a764f0..f07c1e065c 100644 --- a/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx +++ b/content/100-getting-started/02-setup-prisma/200-add-to-existing-project/110-relational-databases/150-introspection.mdx @@ -388,8 +388,8 @@ Prisma's data model is a declarative representation of your database schema and Right now, there's a few minor "issues" with the data model: -- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. -- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. +- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. +- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. - Even after lowercasing, the `post` field on `User` is still slightly misnamed. That's because it actually refers to a [list](/concepts/components/prisma-schema/data-model#type-modifiers) of posts – a better name therefore would be the plural form: `posts`. These changes are relevant for the generated Prisma Client API where using lowercased relation fields `author`, `posts`, `profile` and `user` will feel more natural and idiomatic to JavaScript/TypeScript developers. You can therefore [configure your Prisma Client API](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names). @@ -423,7 +423,7 @@ model User { } ``` -In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API. +In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API.
Using custom model and field names @@ -529,7 +529,7 @@ model User { -Refer to the [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for detailed information about the schema definition. +Refer to the [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for detailed information about the schema definition. @@ -537,8 +537,8 @@ Prisma's data model is a declarative representation of your database schema and Right now, there's a few minor "issues" with the data model: -- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. -- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. +- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. +- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. - Even after lowercasing, the `post` field on `User` is still slightly misnamed. That's because it actually refers to a [list](/concepts/components/prisma-schema/data-model#type-modifiers) of posts – a better name therefore would be the plural form: `posts`. These changes are relevant for the generated Prisma Client API where using lowercased relation fields `author`, `posts`, `profile` and `user` will feel more natural and idiomatic to JavaScript/TypeScript developers. You can therefore [configure your Prisma Client API](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names). @@ -574,7 +574,7 @@ model User { } ``` -In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API. +In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API. Sometimes though, you may want to make additional changes to the names of the columns and tables that are exposed in the Prisma Client API. A common example is to translate _snake_case_ notation which is often used in database schemas into _PascalCase_ and _camelCase_ notations which feel more natural for JavaScript/TypeScript developers. @@ -675,8 +675,8 @@ Prisma's data model is a declarative representation of your database schema and Right now, there's a few minor "issues" with the data model: -- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. -- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. +- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. +- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. - Even after lowercasing, the `post` field on `User` is still slightly misnamed. That's because it actually refers to a [list](/concepts/components/prisma-schema/data-model#type-modifiers) of posts – a better name therefore would be the plural form: `posts`. These changes are relevant for the generated Prisma Client API where using lowercased relation fields `author`, `posts`, `profile` and `user` will feel more natural and idiomatic to JavaScript/TypeScript developers. You can therefore [configure your Prisma Client API](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names). @@ -710,7 +710,7 @@ model User { } ``` -In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API. +In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API.
Using custom model and field names @@ -815,7 +815,7 @@ model User { -Refer to the [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for detailed information about the schema definition. +Refer to the [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for detailed information about the schema definition. @@ -865,7 +865,7 @@ Prisma Migrate will now keep the manually added relation fields. Because relation fields are _virtual_ (i.e. they _do not directly manifest in the database_), you can manually rename them in your Prisma schema without touching the database. -In this example, the database schema follows the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models. This optimizes the ergonomics of the generated Prisma Client API. +In this example, the database schema follows the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models. This optimizes the ergonomics of the generated Prisma Client API.
Using custom model and field names @@ -971,8 +971,8 @@ Prisma's data model is a declarative representation of your database schema and Right now, there's a few minor "issues" with the data model: -- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. -- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. +- The `User` relation field is uppercased and therefore doesn't adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) . To express more "semantics", it would also be nice if this field was called `author` to _describe_ the relationship between `User` and `Post` better. +- The `Post` and `Profile` relation fields on `User` as well as the `User` relation field on `Profile` are all uppercased. To adhere to Prisma's [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions-1) , both fields should be lowercased to `post`, `profile` and `user`. - Even after lowercasing, the `post` field on `User` is still slightly misnamed. That's because it actually refers to a [list](/concepts/components/prisma-schema/data-model#type-modifiers) of posts – a better name therefore would be the plural form: `posts`. These changes are relevant for the generated Prisma Client API where using lowercased relation fields `author`, `posts`, `profile` and `user` will feel more natural and idiomatic to JavaScript/TypeScript developers. You can therefore [configure your Prisma Client API](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names). @@ -1006,7 +1006,7 @@ model User { } ``` -In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API. +In this example, the database schema did follow the [naming conventions](/reference/api-reference/prisma-schema-reference#naming-conventions) for Prisma models (only the virtual relation fields that were generated from introspection did not adhere to them and needed adjustment). This optimizes the ergonomics of the generated Prisma Client API.
Using custom model and field names diff --git a/content/200-orm/050-overview/100-introduction/500-databases/01-database-drivers.mdx b/content/200-orm/050-overview/100-introduction/500-databases/01-database-drivers.mdx index 7297c7eaec..0f52eaee8a 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/01-database-drivers.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/01-database-drivers.mdx @@ -7,7 +7,7 @@ tocDepth: 4 ## Default built-in drivers -One of Prisma Client's components is the [Query Engine](./prisma-engines/query-engine) . The Query Engine is responsible for transforming Prisma Client queries to SQL statements. The Query Engine connects to your database using the included drivers that don't require additional setup. The built-in drivers use TCP connections to connect to the database. +One of Prisma Client's components is the [Query Engine](./prisma-engines/query-engine) . The Query Engine is responsible for transforming Prisma Client queries to SQL statements. The Query Engine connects to your database using the included drivers that don't require additional setup. The built-in drivers use TCP connections to connect to the database. ![Query flow from the user application to the database with Prisma Client](./images/drivers/qe-query-execution-flow.png) diff --git a/content/200-orm/050-overview/100-introduction/500-databases/03-postgresql.mdx b/content/200-orm/050-overview/100-introduction/500-databases/03-postgresql.mdx index 9082af73e4..56ac7308a5 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/03-postgresql.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/03-postgresql.mdx @@ -9,7 +9,7 @@ tocDepth: 3 The PostgreSQL data source connector connects Prisma to a [PostgreSQL](https://www.postgresql.org/) database server. -By default, the PostgreSQL connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. +By default, the PostgreSQL connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. @@ -210,7 +210,7 @@ The PostgreSQL connector maps the [scalar types](/concepts/components/prisma-sch | Composite types | Not yet | n/a | | | | Domain types | Not yet | n/a | | | -[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: +[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: ```prisma file=schema.prisma model Device { diff --git a/content/200-orm/050-overview/100-introduction/500-databases/04-mysql.mdx b/content/200-orm/050-overview/100-introduction/500-databases/04-mysql.mdx index 3fe1615cb9..2c6d3e9845 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/04-mysql.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/04-mysql.mdx @@ -9,7 +9,7 @@ tocDepth: 3 The MySQL data source connector connects Prisma to a [MySQL](https://www.mysql.com/) database server. -By default, the MySQL connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. +By default, the MySQL connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. @@ -191,7 +191,7 @@ When introspecting a MySQL database, the database types are mapped to Prisma acc | `multipolygon` | `Unsupported` | Not yet | | | `geometrycollection` | `Unsupported` | Not yet | | -[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: +[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: ```prisma file=schema.prisma model Device { diff --git a/content/200-orm/050-overview/100-introduction/500-databases/05-sqlite.mdx b/content/200-orm/050-overview/100-introduction/500-databases/05-sqlite.mdx index 3f19608aa2..bcf30844d8 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/05-sqlite.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/05-sqlite.mdx @@ -9,7 +9,7 @@ tocDepth: 3 The SQLite data source connector connects Prisma to a [SQLite](https://www.sqlite.org/) database file. These files always have the file ending `.db` (e.g.: `dev.db`). -By default, the SQLite connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. +By default, the SQLite connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/concepts/components/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client. diff --git a/content/200-orm/050-overview/100-introduction/500-databases/07-mongodb.mdx b/content/200-orm/050-overview/100-introduction/500-databases/07-mongodb.mdx index 5b6f759c5d..47db70e6bc 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/07-mongodb.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/07-mongodb.mdx @@ -564,7 +564,7 @@ When introspecting a MongoDB database, Prisma uses the relevant [scalar types](/ | ------------------------- | -------- | :-------: | :----------------------------- | :---- | | `objectId` | `String` | ✔️ | `@db.ObjectId` | | -[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: +[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: ```prisma file=schema.prisma model Example { diff --git a/content/200-orm/050-overview/100-introduction/500-databases/08-cockroachdb.mdx b/content/200-orm/050-overview/100-introduction/500-databases/08-cockroachdb.mdx index dee427f3aa..2536e39276 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/08-cockroachdb.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/08-cockroachdb.mdx @@ -127,7 +127,7 @@ When introspecting a CockroachDB database, the database types are mapped to Pris | `JSONB` \| `JSON` | `Json` | ✔️ | `@db.JsonB` | | | Array types | `[]` | ✔️ | | | -[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: +[Introspection](/concepts/components/introspection) adds native database types that are **not yet supported** as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) fields: ```prisma file=schema.prisma model Device { diff --git a/content/200-orm/050-overview/100-introduction/500-databases/890-neon.mdx b/content/200-orm/050-overview/100-introduction/500-databases/890-neon.mdx index d17c516c57..b870c36f06 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/890-neon.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/890-neon.mdx @@ -119,7 +119,7 @@ DATABASE_URL=postgres://daniel:@ep-mute-rain-952417.us-east-2.aws.neon The [Neon serverless driver](https://github.com/neondatabase/serverless) is a low-latency Postgres driver for JavaScript and TypeScript that allows you to query data from serverless and edge environments over HTTP or WebSockets in place of TCP. -You can use Prisma along with the Neon serverless driver using a [driver adapter](/concepts/components/database-drivers#driver-adapters) . A driver adapter allows you to use a different database driver from the default Prisma provides to communicate with your database. +You can use Prisma along with the Neon serverless driver using a [driver adapter](/concepts/components/database-drivers#driver-adapters) . A driver adapter allows you to use a different database driver from the default Prisma provides to communicate with your database. diff --git a/content/200-orm/050-overview/100-introduction/500-databases/900-turso.mdx b/content/200-orm/050-overview/100-introduction/500-databases/900-turso.mdx index b7126989d4..f74c8e8d54 100644 --- a/content/200-orm/050-overview/100-introduction/500-databases/900-turso.mdx +++ b/content/200-orm/050-overview/100-introduction/500-databases/900-turso.mdx @@ -52,7 +52,7 @@ Many aspects of using Prisma with Turso are just like using Prisma with any othe There are a number of differences between Turso and SQLite to consider. You should be aware of the following when deciding to use Turso and Prisma: - **Remote and embedded SQLite databases**. libSQL uses HTTP to connect to the remote SQLite database. libSQL also supports remote database replicas and embedded replicas. Embedded replicas enable you to replicate your primary database inside your application. -- **Making schema changes**. Since libSQL uses HTTP to connect to the remote database, this makes it incompatible with Prisma Migrate. However, you can use [`prisma migrate diff`](/reference/api-reference/command-reference#migrate-diff) to create a schema migration and then apply the changes to your database using [Turso's CLI](https://docs.turso.tech/reference/turso-cli). +- **Making schema changes**. Since libSQL uses HTTP to connect to the remote database, this makes it incompatible with Prisma Migrate. However, you can use [`prisma migrate diff`](/reference/api-reference/command-reference#migrate-diff) to create a schema migration and then apply the changes to your database using [Turso's CLI](https://docs.turso.tech/reference/turso-cli). ## How to connect and query a Turso database diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/015-instantiate-prisma-client.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/015-instantiate-prisma-client.mdx index 9a836ccf35..0fb8ebfa69 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/015-instantiate-prisma-client.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/015-instantiate-prisma-client.mdx @@ -35,7 +35,7 @@ const prisma = new PrismaClient() -You can further customize `PrismaClient` with [constructor parameters](/reference/api-reference/prisma-client-reference#prismaclient) - for example, set [logging levels](logging) or customize [error formatting](error-formatting). +You can further customize `PrismaClient` with [constructor parameters](/reference/api-reference/prisma-client-reference#prismaclient) - for example, set [logging levels](logging) or customize [error formatting](error-formatting). @@ -43,7 +43,7 @@ You can further customize `PrismaClient` with [constructor parameters](/referenc ## The number of `PrismaClient` instances matters -Your application should generally only create **one instance** of `PrismaClient`. How to achieve this depends on whether you are using Prisma in a [long-running application](/guides/performance-and-optimization/connection-management#prismaclient-in-long-running-applications) or in a [serverless environment](/guides/performance-and-optimization/connection-management#prismaclient-in-serverless-environments) . +Your application should generally only create **one instance** of `PrismaClient`. How to achieve this depends on whether you are using Prisma in a [long-running application](/guides/performance-and-optimization/connection-management#prismaclient-in-long-running-applications) or in a [serverless environment](/guides/performance-and-optimization/connection-management#prismaclient-in-serverless-environments) . The reason for this is that each instance of `PrismaClient` manages a connection pool, which means that a large number of clients can **exhaust the database connection limit**. This applies to all database connectors. diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/130-logging.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/130-logging.mdx index 355a3da58b..af66d8b9a7 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/130-logging.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/130-logging.mdx @@ -6,12 +6,12 @@ metaDescription: 'Learn how to configure Prisma Client to log the raw SQL querie -Use the `PrismaClient` [`log`](/reference/api-reference/prisma-client-reference#log) parameter to configure [log levels](/reference/api-reference/prisma-client-reference#log-levels) , including warnings, errors, and information about the queries sent to the database. +Use the `PrismaClient` [`log`](/reference/api-reference/prisma-client-reference#log) parameter to configure [log levels](/reference/api-reference/prisma-client-reference#log-levels) , including warnings, errors, and information about the queries sent to the database. Prisma supports two types of logging: - Logging to [stdout](https://en.wikipedia.org/wiki/Standard_streams) (default) -- Event-based logging (use [`$on()`](/reference/api-reference/prisma-client-reference#on) method to [subscribe to events](#event-based-logging)) +- Event-based logging (use [`$on()`](/reference/api-reference/prisma-client-reference#on) method to [subscribe to events](#event-based-logging)) @@ -171,4 +171,4 @@ Query: db.Post.aggregate([ { $match: { userId: { $in: [ "622f0bbbdf635a42016ee32 -The exact [event (`e`) type and the properties available](/reference/api-reference/prisma-client-reference#event-types) depends on the log level. +The exact [event (`e`) type and the properties available](/reference/api-reference/prisma-client-reference#event-types) depends on the log level. diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/150-error-formatting.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/150-error-formatting.mdx index aa3b961010..7e6e5f8cfc 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/150-error-formatting.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/150-error-formatting.mdx @@ -32,7 +32,7 @@ In order to configure these different error formatting levels, there are two opt ### Formatting via the `PrismaClient` constructor -Alternatively, use the `PrismaClient` [`errorFormat`](/reference/api-reference/prisma-client-reference#errorformat) parameter to set the error format: +Alternatively, use the `PrismaClient` [`errorFormat`](/reference/api-reference/prisma-client-reference#errorformat) parameter to set the error format: ```ts const prisma = new PrismaClient({ diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/100-connection-management.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/100-connection-management.mdx index 3f0d38e0fe..b3135868ba 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/100-connection-management.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/100-connection-management.mdx @@ -9,18 +9,18 @@ tocDepth: 3 `PrismaClient` connects and disconnects from your data source using the following two methods: -- [`$connect()`](/reference/api-reference/prisma-client-reference#connect-1) -- [`$disconnect()`](/reference/api-reference/prisma-client-reference#disconnect-1) +- [`$connect()`](/reference/api-reference/prisma-client-reference#connect-1) +- [`$disconnect()`](/reference/api-reference/prisma-client-reference#disconnect-1) In most cases, you **do not need to explicitly call these methods**. `PrismaClient` automatically connects when you run your first query, creates a [connection pool](connection-pool), and disconnects when the Node.js process ends. -See the [connection management guide](/guides/performance-and-optimization/connection-management) for information about managing connections for different deployment paradigms (long-running processes and serverless functions). +See the [connection management guide](/guides/performance-and-optimization/connection-management) for information about managing connections for different deployment paradigms (long-running processes and serverless functions). ## $connect() -It is not necessary to call [`$connect()`](/reference/api-reference/prisma-client-reference#connect-1) thanks to the _lazy connect_ behavior: The `PrismaClient` instance connects lazily when the first request is made to the API (`$connect()` is called for you under the hood). +It is not necessary to call [`$connect()`](/reference/api-reference/prisma-client-reference#connect-1) thanks to the _lazy connect_ behavior: The `PrismaClient` instance connects lazily when the first request is made to the API (`$connect()` is called for you under the hood). ### Calling $connect() explicitly @@ -35,7 +35,7 @@ await prisma.$connect() ## $disconnect() -When you call [`$disconnect()`](/reference/api-reference/prisma-client-reference#disconnect-1) , Prisma Client: +When you call [`$disconnect()`](/reference/api-reference/prisma-client-reference#disconnect-1) , Prisma Client: 1. Runs the [`beforeExit` hook](#exit-hooks) 2. Ends the Query Engine child process and closes all connections diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/115-connection-pool.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/115-connection-pool.mdx index b5cd357363..5b2f88bb21 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/115-connection-pool.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/115-connection-pool.mdx @@ -30,7 +30,7 @@ The following steps describe how the query engine uses the connection pool: 1. If the query engine cannot reserve a connection from the pool, queries are added to a FIFO (First In First Out) queue in memory. FIFO means that queries are processed in the order they enter the queue. 1. If the query engine cannot process a query in the queue for **before the [time limit](#default-pool-timeout)**, it throws an exception with error code `P2024` for that query and moves on to the next one in the queue. -If you consistently experience pool timeout errors, you need to [optimize the connection pool](/guides/performance-and-optimization/connection-management#optimizing-the-connection-pool) . +If you consistently experience pool timeout errors, you need to [optimize the connection pool](/guides/performance-and-optimization/connection-management#optimizing-the-connection-pool) . ### Connection pool size @@ -44,7 +44,7 @@ num_physical_cpus * 2 + 1 `num_physical_cpus` represents the number of physical CPUs on the machine your application is running on. If your machine has **four** physical CPUs, your connection pool will contain **nine** connections (`4 * 2 + 1 = 9`). -Although the formula represents a good starting point, the [recommended connection limit](/guides/performance-and-optimization/connection-management#recommended-connection-pool-size) also depends on your deployment paradigm - particularly if you are using serverless. +Although the formula represents a good starting point, the [recommended connection limit](/guides/performance-and-optimization/connection-management#recommended-connection-pool-size) also depends on your deployment paradigm - particularly if you are using serverless. #### Setting the connection pool size @@ -61,7 +61,7 @@ datasource db { The number of connections Prisma Client uses can be viewed using [logging](/concepts/components/prisma-client/working-with-prismaclient/logging) and [metrics](/concepts/components/prisma-client/metrics). -Using the `info` [logging level](/reference/api-reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated. +Using the `info` [logging level](/reference/api-reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated. For example, consider the following Prisma Client instance and invocation: @@ -200,7 +200,7 @@ datasource db { } ``` -You can choose to [disable the connection pool timeout if queries **must** remain in the queue](/guides/performance-and-optimization/connection-management#disabling-the-pool-timeout) - for example, if you are importing a large number of records in parallel and are confident that the queue will not use up all available RAM before the job is complete. +You can choose to [disable the connection pool timeout if queries **must** remain in the queue](/guides/performance-and-optimization/connection-management#disabling-the-pool-timeout) - for example, if you are importing a large number of records in parallel and are confident that the queue will not use up all available RAM before the job is complete. ## MongoDB @@ -210,7 +210,7 @@ The MongoDB connector does not use the Prisma connection pool. The connection po You cannot increase the `connection_limit` beyond what the underlying database can support. This is a particular challenge in serverless environments, where each function manages an instance of `PrismaClient` - and its own connection pool. -Consider introducing [an external connection pooler like PgBouncer](/guides/performance-and-optimization/connection-management#pgbouncer) to prevent your application or functions from exhausting the database connection limit. +Consider introducing [an external connection pooler like PgBouncer](/guides/performance-and-optimization/connection-management#pgbouncer) to prevent your application or functions from exhausting the database connection limit. ## Manual database connection handling diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/200-pgbouncer.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/200-pgbouncer.mdx index 9879515fcb..4b6cd6cd29 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/200-pgbouncer.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/200-pgbouncer.mdx @@ -48,7 +48,7 @@ Error: undefined: Database error Error querying the database: db error: ERROR: prepared statement "s0" already exists ``` -To work around this issue, you must connect directly to the database rather than going through PgBouncer. To achieve this, you can use the [`directUrl`](/reference/api-reference/prisma-schema-reference#fields) field in your [`datasource`](/reference/api-reference/prisma-schema-reference#datasource) block. +To work around this issue, you must connect directly to the database rather than going through PgBouncer. To achieve this, you can use the [`directUrl`](/reference/api-reference/prisma-schema-reference#fields) field in your [`datasource`](/reference/api-reference/prisma-schema-reference#datasource) block. For example, consider the following `datasource` block: diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/index.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/index.mdx index f7ca88a45f..53bf93c935 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/index.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/50-databases-connections/index.mdx @@ -46,7 +46,7 @@ If you have **one** application instances: If you have **multiple** application instances: -- You must **manually** [set the `connection_limit` parameter](/concepts/components/prisma-client/working-with-prismaclient/connection-pool#setting-the-connection-pool-size) . For example, if your calculated pool size is _10_ and you have _2_ instances of your app, the `connection_limit` parameter should be **no more than _5_**. +- You must **manually** [set the `connection_limit` parameter](/concepts/components/prisma-client/working-with-prismaclient/connection-pool#setting-the-connection-pool-size) . For example, if your calculated pool size is _10_ and you have _2_ instances of your app, the `connection_limit` parameter should be **no more than _5_**. - You can optionally [tune the pool size](#optimizing-the-connection-pool). ### PrismaClient in long-running applications @@ -84,7 +84,7 @@ You do not have to replicate the example above exactly - the goal is to make sur #### Do not explicitly `$disconnect()` -You [do not need to explicitly `$disconnect()`](/concepts/components/prisma-client/working-with-prismaclient/connection-management#calling-disconnect-explicitly) in the context of a long-running application that is continuously serving requests. Opening a new connection takes time and can slow down your application if you disconnect after each query. +You [do not need to explicitly `$disconnect()`](/concepts/components/prisma-client/working-with-prismaclient/connection-management#calling-disconnect-explicitly) in the context of a long-running application that is continuously serving requests. Opening a new connection takes time and can slow down your application if you disconnect after each query. #### Prevent hot reloading from creating new instances of `PrismaClient` @@ -219,7 +219,7 @@ export async function handler() { #### Do not explicitly $disconnect() -You [do not need to explicitly `$disconnect()`](/concepts/components/prisma-client/working-with-prismaclient/connection-management#calling-disconnect-explicitly) at the end of a function, as there is a possibility that the container might be reused. Opening a new connection takes time and slows down your function's ability to process requests. +You [do not need to explicitly `$disconnect()`](/concepts/components/prisma-client/working-with-prismaclient/connection-management#calling-disconnect-explicitly) at the end of a function, as there is a possibility that the container might be reused. Opening a new connection takes time and slows down your function's ability to process requests. ### Other serverless considerations @@ -241,7 +241,7 @@ Depending on your serverless concurrency limit (the number of serverless functio ## Optimizing the connection pool -If the query engine cannot [process a query in the queue before the time limit](/concepts/components/prisma-client/working-with-prismaclient/connection-pool#how-the-connection-pool-works) , you will see connection pool timeout exceptions in your log. A connection pool timeout can occur if: +If the query engine cannot [process a query in the queue before the time limit](/concepts/components/prisma-client/working-with-prismaclient/connection-pool#how-the-connection-pool-works) , you will see connection pool timeout exceptions in your log. A connection pool timeout can occur if: - Many users are accessing your app simultaneously - You send a large number of queries in parallel (for example, using `await Promise.all()`) diff --git a/content/200-orm/100-prisma-client/000-setup-and-configuration/index.mdx b/content/200-orm/100-prisma-client/000-setup-and-configuration/index.mdx index f780f8fb93..526a8f7b28 100644 --- a/content/200-orm/100-prisma-client/000-setup-and-configuration/index.mdx +++ b/content/200-orm/100-prisma-client/000-setup-and-configuration/index.mdx @@ -6,7 +6,7 @@ metaDescription: 'This section explains how to generate, configure, and instanti -This section describes how to set up, generate, configure, and instantiate `PrismaClient` , as well as when and how to actively [manage connections](connection-management). +This section describes how to set up, generate, configure, and instantiate `PrismaClient` , as well as when and how to actively [manage connections](connection-management). diff --git a/content/200-orm/100-prisma-client/100-queries/030-crud.mdx b/content/200-orm/100-prisma-client/100-queries/030-crud.mdx index c34dd58584..f876969148 100644 --- a/content/200-orm/100-prisma-client/100-queries/030-crud.mdx +++ b/content/200-orm/100-prisma-client/100-queries/030-crud.mdx @@ -14,7 +14,7 @@ This page describes how to perform CRUD operations with your generated Prisma Cl - [Update](#update) - [Delete](#delete) -Refer to the [Prisma Client API reference documentation](/reference/api-reference/prisma-client-reference) for detailed explanations of each method. +Refer to the [Prisma Client API reference documentation](/reference/api-reference/prisma-client-reference) for detailed explanations of each method. @@ -151,7 +151,7 @@ For **MongoDB**, ensure your data is in a uniform shape and matches the model de ### Create a single record -The following query creates ([`create`](/reference/api-reference/prisma-client-reference#create) ) a single user with two fields: +The following query creates ([`create`](/reference/api-reference/prisma-client-reference#create) ) a single user with two fields: @@ -228,7 +228,7 @@ For more information about working with generated types, see: [Generated types]( Prisma Client supports bulk inserts as a GA feature in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later. -The following [`createMany`](/reference/api-reference/prisma-client-reference#createmany) query creates multiple users and skips any duplicates (`email` must be unique): +The following [`createMany`](/reference/api-reference/prisma-client-reference#createmany) query creates multiple users and skips any duplicates (`email` must be unique): @@ -296,7 +296,7 @@ See [Working with relations > Nested writes](relation-queries#nested-writes) for ### Get record by ID or unique identifier -The following queries return a single record ([`findUnique`](/reference/api-reference/prisma-client-reference#findunique) ) by unique identifier or ID: +The following queries return a single record ([`findUnique`](/reference/api-reference/prisma-client-reference#findunique) ) by unique identifier or ID: ```ts // By unique identifier @@ -327,7 +327,7 @@ const user = await prisma.user.findUnique({ ### Get all records -The following [`findMany`](/reference/api-reference/prisma-client-reference#findmany) query returns _all_ `User` records: +The following [`findMany`](/reference/api-reference/prisma-client-reference#findmany) query returns _all_ `User` records: ```ts const users = await prisma.user.findMany() @@ -337,7 +337,7 @@ You can also [paginate your results](pagination). ### Get the first record that matches a specific criteria -The following [`findFirst`](/reference/api-reference/prisma-client-reference#findfirst) query returns the _most recently created user_ with at least one post that has more than 100 likes: +The following [`findFirst`](/reference/api-reference/prisma-client-reference#findfirst) query returns the _most recently created user_ with at least one post that has more than 100 likes: 1. Order users by descending ID (largest first) - the largest ID is the most recent 2. Return the first user in descending order with at least one post that has more than 100 likes @@ -379,7 +379,7 @@ const users = await prisma.user.findMany({ #### Filter by multiple field values -The following query uses a combination of [operators](/reference/api-reference/prisma-client-reference#filter-conditions-and-operators) to return users whose name start with `E` _or_ administrators with at least 1 profile view: +The following query uses a combination of [operators](/reference/api-reference/prisma-client-reference#filter-conditions-and-operators) to return users whose name start with `E` _or_ administrators with at least 1 profile view: ```ts const users = await prisma.user.findMany({ @@ -569,13 +569,13 @@ For more information about including relations, see [Select fields and include r #### Include a filtered list of relations -See [Working with relations](relation-queries#filter-a-list-of-relations) to find out how to combine [`include`](/reference/api-reference/prisma-client-reference#include) and `where` for a filtered list of relations - for example, only include a user's published posts. +See [Working with relations](relation-queries#filter-a-list-of-relations) to find out how to combine [`include`](/reference/api-reference/prisma-client-reference#include) and `where` for a filtered list of relations - for example, only include a user's published posts. ## Update ### Update a single record -The following query uses [`update`](/reference/api-reference/prisma-client-reference#update) to find and update a single `User` record by `email`: +The following query uses [`update`](/reference/api-reference/prisma-client-reference#update) to find and update a single `User` record by `email`: @@ -610,7 +610,7 @@ const updateUser = await prisma.user.update({ ### Update multiple records -The following query uses [`updateMany`](/reference/api-reference/prisma-client-reference#updatemany) to update all `User` records that contain `prisma.io`: +The following query uses [`updateMany`](/reference/api-reference/prisma-client-reference#updatemany) to update all `User` records that contain `prisma.io`: @@ -642,7 +642,7 @@ const updateUsers = await prisma.user.updateMany({ ### Update _or_ create records -The following query uses [`upsert`](/reference/api-reference/prisma-client-reference#upsert) to update a `User` record with a specific email address, or create that `User` record if it does not exist: +The following query uses [`upsert`](/reference/api-reference/prisma-client-reference#upsert) to update a `User` record with a specific email address, or create that `User` record if it does not exist: @@ -695,7 +695,7 @@ A limitation to using `upsert` as a workaround for `findOrCreate` is that `upser ### Update a number field -Use [atomic number operations](/reference/api-reference/prisma-client-reference#atomic-number-operations) to update a number field **based on its current value** - for example, increment or multiply. The following query increments the `views` and `likes` fields by `1`: +Use [atomic number operations](/reference/api-reference/prisma-client-reference#atomic-number-operations) to update a number field **based on its current value** - for example, increment or multiply. The following query increments the `views` and `likes` fields by `1`: ```ts const updatePosts = await prisma.post.updateMany({ @@ -712,13 +712,13 @@ const updatePosts = await prisma.post.updateMany({ ### Connect and disconnect related records -Refer to [Working with relations](relation-queries) for information about disconnecting ([`disconnect`](/reference/api-reference/prisma-client-reference#disconnect) ) and connecting ([`connect`](/reference/api-reference/prisma-client-reference#connect) ) related records. +Refer to [Working with relations](relation-queries) for information about disconnecting ([`disconnect`](/reference/api-reference/prisma-client-reference#disconnect) ) and connecting ([`connect`](/reference/api-reference/prisma-client-reference#connect) ) related records. ## Delete ### Delete a single record -The following query uses [`delete`](/reference/api-reference/prisma-client-reference#delete) to delete a single `User` record: +The following query uses [`delete`](/reference/api-reference/prisma-client-reference#delete) to delete a single `User` record: ```ts const deleteUser = await prisma.user.delete({ @@ -764,7 +764,7 @@ In [2.26.0](https://github.com/prisma/prisma/releases/tag/2.26.0) and later it i -The following query uses [`delete`](/reference/api-reference/prisma-client-reference#delete) to delete a single `User` record: +The following query uses [`delete`](/reference/api-reference/prisma-client-reference#delete) to delete a single `User` record: ```ts const deleteUser = await prisma.user.delete({ diff --git a/content/200-orm/100-prisma-client/100-queries/035-select-fields.mdx b/content/200-orm/100-prisma-client/100-queries/035-select-fields.mdx index e36bbac87d..9ff3c459b5 100644 --- a/content/200-orm/100-prisma-client/100-queries/035-select-fields.mdx +++ b/content/200-orm/100-prisma-client/100-queries/035-select-fields.mdx @@ -14,8 +14,8 @@ By default, when a query returns records (as opposed to a count), the result inc To customize the result: -- Use [`select`](/reference/api-reference/prisma-client-reference#select) to return specific fields - [you can also use a nested `select` to include relation fields](relation-queries#select-specific-relation-fields) -- Use [`include`](/reference/api-reference/prisma-client-reference#include) to explicitly [include relations](relation-queries#nested-reads) +- Use [`select`](/reference/api-reference/prisma-client-reference#select) to return specific fields - [you can also use a nested `select` to include relation fields](relation-queries#select-specific-relation-fields) +- Use [`include`](/reference/api-reference/prisma-client-reference#include) to explicitly [include relations](relation-queries#nested-reads) Selecting only the fields and relations that you require rather than relying on the default selection set can ✔ reduce the size of the response and ✔ improve query speed. diff --git a/content/200-orm/100-prisma-client/100-queries/037-relation-queries.mdx b/content/200-orm/100-prisma-client/100-queries/037-relation-queries.mdx index 6878ad7da8..e2735ae62a 100644 --- a/content/200-orm/100-prisma-client/100-queries/037-relation-queries.mdx +++ b/content/200-orm/100-prisma-client/100-queries/037-relation-queries.mdx @@ -9,7 +9,7 @@ tocDepth: 4 A key feature of Prisma Client is the ability to query [relations](/concepts/components/prisma-schema/relations) between two or more models. Relation queries include: -- [Nested reads](#nested-reads) (sometimes referred to as _eager loading_) via [`select`](/reference/api-reference/prisma-client-reference#select) and [`include`](/reference/api-reference/prisma-client-reference#include) +- [Nested reads](#nested-reads) (sometimes referred to as _eager loading_) via [`select`](/reference/api-reference/prisma-client-reference#select) and [`include`](/reference/api-reference/prisma-client-reference#include) - [Nested writes](#nested-writes) with [transactional](transactions) guarantees - [Filtering on related records](#relation-filters) @@ -21,8 +21,8 @@ Prisma Client also has a [fluent API for traversing relations](#fluent-api). Nested reads allow you to read related data from multiple tables in your database - such as a user and that user's posts. You can: -- Use [`include`](/reference/api-reference/prisma-client-reference#include) to include related records, such as a user's posts or profile, in the query response. -- Use a nested [`select`](/reference/api-reference/prisma-client-reference#select) to include specific fields from a related record. You can also nest `select` inside an `include`. +- Use [`include`](/reference/api-reference/prisma-client-reference#include) to include related records, such as a user's posts or profile, in the query response. +- Use a nested [`select`](/reference/api-reference/prisma-client-reference#select) to include specific fields from a related record. You can also nest `select` inside an `include`. The following example returns a single user and that user's posts: @@ -468,8 +468,8 @@ const result = await prisma.user.create({ There are two ways to create or update a single record and multiple related records - for example, a user with multiple posts: -- Use a nested [`create`](/reference/api-reference/prisma-client-reference#create-1) query -- Use a nested [`createMany`](/reference/api-reference/prisma-client-reference#createmany-1) query +- Use a nested [`create`](/reference/api-reference/prisma-client-reference#create-1) query +- Use a nested [`createMany`](/reference/api-reference/prisma-client-reference#createmany-1) query Each technique has pros and cons: @@ -482,7 +482,7 @@ Each technique has pros and cons: | Supports has-many relations | ✔ | ✔ | For example, you can create a user and multiple posts (one user has many posts) | | Supports many-to-many relations | ✔ | ✘ | For example, you can create a post and several categories (one post can have many categories, and one category can have many posts) | -The following query uses nested [`create`](/reference/api-reference/prisma-client-reference#create) to create: +The following query uses nested [`create`](/reference/api-reference/prisma-client-reference#create) to create: - One user - Two posts @@ -570,7 +570,7 @@ const result = await prisma.user.create({ -The following query uses a nested [`createMany`](/reference/api-reference/prisma-client-reference#create) to create: +The following query uses a nested [`createMany`](/reference/api-reference/prisma-client-reference#create) to create: - One user - Two posts @@ -669,7 +669,7 @@ const createMany = await prisma.user.createMany({ ### Connect multiple records -The following query creates ([`create`](/reference/api-reference/prisma-client-reference#create) ) a new `User` record and connects that record ([`connect`](/reference/api-reference/prisma-client-reference#connect) ) to three existing posts: +The following query creates ([`create`](/reference/api-reference/prisma-client-reference#create) ) a new `User` record and connects that record ([`connect`](/reference/api-reference/prisma-client-reference#connect) ) to three existing posts: @@ -720,7 +720,7 @@ const result = await prisma.user.create({ ### Connect a single record -You can [`connect`](/reference/api-reference/prisma-client-reference#connect) an existing record to a new or existing user. The following query connects an existing post (`id: 11`) to an existing user (`id: 9`) +You can [`connect`](/reference/api-reference/prisma-client-reference#connect) an existing record to a new or existing user. The following query connects an existing post (`id: 11`) to an existing user (`id: 9`) ```ts highlight=6-9;normal const result = await prisma.user.update({ @@ -742,7 +742,7 @@ const result = await prisma.user.update({ ### Connect _or_ create a record -If a related record may or may not already exist, use [`connectOrCreate`](/reference/api-reference/prisma-client-reference#connectorcreate) to connect the related record: +If a related record may or may not already exist, use [`connectOrCreate`](/reference/api-reference/prisma-client-reference#connectorcreate) to connect the related record: - Connect a `User` with the email address `viola@prisma.io` _or_ - Create a new `User` with the email address `viola@prisma.io` if the user does not already exist @@ -880,7 +880,7 @@ const result = await prisma.post.update({ ### Disconnect all related records -To [`disconnect`](/reference/api-reference/prisma-client-reference#disconnect) _all_ related records in a one-to-many relation (a user has many posts), `set` the relation to an empty list as shown: +To [`disconnect`](/reference/api-reference/prisma-client-reference#disconnect) _all_ related records in a one-to-many relation (a user has many posts), `set` the relation to an empty list as shown: diff --git a/content/200-orm/100-prisma-client/100-queries/050-filtering-and-sorting.mdx b/content/200-orm/100-prisma-client/100-queries/050-filtering-and-sorting.mdx index f12dd4371a..7c967e3c0a 100644 --- a/content/200-orm/100-prisma-client/100-queries/050-filtering-and-sorting.mdx +++ b/content/200-orm/100-prisma-client/100-queries/050-filtering-and-sorting.mdx @@ -87,11 +87,11 @@ const result = await prisma.user.findMany({ ### Filter conditions and operators -Refer to Prisma Client's reference documentation for [a full list of operators](/reference/api-reference/prisma-client-reference#filter-conditions-and-operators) , such as `startsWith` and `contains`. +Refer to Prisma Client's reference documentation for [a full list of operators](/reference/api-reference/prisma-client-reference#filter-conditions-and-operators) , such as `startsWith` and `contains`. #### Combining operators -You can use operators (such as [`NOT`](/reference/api-reference/prisma-client-reference#not-1) and [`OR`](/reference/api-reference/prisma-client-reference#or) ) to filter by a combination of conditions. The following query returns all users with an `email` that ends in `"prisma.io"` or `"gmail.com"`, but not `"hotmail.com"`: +You can use operators (such as [`NOT`](/reference/api-reference/prisma-client-reference#not-1) and [`OR`](/reference/api-reference/prisma-client-reference#or) ) to filter by a combination of conditions. The following query returns all users with an `email` that ends in `"prisma.io"` or `"gmail.com"`, but not `"hotmail.com"`: @@ -206,7 +206,7 @@ const res = await prisma.post.findMany({ ### Filter on scalar lists / arrays -Scalar lists (for example, `String[]`) have a special set of [filter conditions](/reference/api-reference/prisma-client-reference#scalar-list-filters) - for example, the following query returns all posts where the `tags` array contains `databases`: +Scalar lists (for example, `String[]`) have a special set of [filter conditions](/reference/api-reference/prisma-client-reference#scalar-list-filters) - for example, the following query returns all posts where the `tags` array contains `databases`: ```ts const posts = await client.post.findMany({ @@ -276,7 +276,7 @@ const users = await prisma.user.findMany({ ## Sorting -Use [`orderBy`](/reference/api-reference/prisma-client-reference#orderby) to sort a list of records or a nested list of records by a particular field or set of fields. For example, the following query returns all `User` records sorted by `role` and `name`, **and** each user's posts sorted by `title`: +Use [`orderBy`](/reference/api-reference/prisma-client-reference#orderby) to sort a list of records or a nested list of records by a particular field or set of fields. For example, the following query returns all `User` records sorted by `role` and `name`, **and** each user's posts sorted by `title`: diff --git a/content/200-orm/100-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx b/content/200-orm/100-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx index 28a36aa005..2503e460d0 100644 --- a/content/200-orm/100-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx +++ b/content/200-orm/100-prisma-client/100-queries/056-aggregation-grouping-summarizing.mdx @@ -13,7 +13,7 @@ Prisma Client allows you to count records, aggregate number fields, and select d ## Aggregate -Prisma Client allows you to [`aggregate`](/reference/api-reference/prisma-client-reference#aggregate) on the **number** fields (such as `Int` and `Float`) of a model. The following query returns the average age of all users: +Prisma Client allows you to [`aggregate`](/reference/api-reference/prisma-client-reference#aggregate) on the **number** fields (such as `Int` and `Float`) of a model. The following query returns the average age of all users: ```ts const aggregations = await prisma.user.aggregate({ @@ -96,7 +96,7 @@ This allows you to differentiate between the true aggregate value (which could b ## Group by -Prisma Client's [`groupBy`](/reference/api-reference/prisma-client-reference#groupby) allows you to **group records** by one or more field values - such as `country`, or `country` and `city` and **perform aggregations** on each group, such as finding the average age of people living in a particular city. `groupBy` is a GA in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later. +Prisma Client's [`groupBy`](/reference/api-reference/prisma-client-reference#groupby) allows you to **group records** by one or more field values - such as `country`, or `country` and `city` and **perform aggregations** on each group, such as finding the average age of people living in a particular city. `groupBy` is a GA in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later. The following video uses `groupBy` to summarize total COVID-19 cases by continent: @@ -329,7 +329,7 @@ Both `distinct` and `groupBy` group records by one or more unique field values. ## Count -Use [`count`](/reference/api-reference/prisma-client-reference#count) to count the number of records or non-`null` field values. The following example query counts all users: +Use [`count`](/reference/api-reference/prisma-client-reference#count) to count the number of records or non-`null` field values. The following example query counts all users: ```ts const userCount = await prisma.user.count() @@ -577,7 +577,7 @@ const postCount = await prisma.post.count({ ## Select distinct -Prisma Client allows you to filter duplicate rows from a Prisma Query response to a [`findMany`](/reference/api-reference/prisma-client-reference#findmany) query using [`distinct`](/reference/api-reference/prisma-client-reference#distinct) . `distinct` is often used in combination with [`select`](/reference/api-reference/prisma-client-reference#select) to identify certain unique combinations of values in the rows of your table. +Prisma Client allows you to filter duplicate rows from a Prisma Query response to a [`findMany`](/reference/api-reference/prisma-client-reference#findmany) query using [`distinct`](/reference/api-reference/prisma-client-reference#distinct) . `distinct` is often used in combination with [`select`](/reference/api-reference/prisma-client-reference#select) to identify certain unique combinations of values in the rows of your table. The following example returns all fields for all `User` records with distinct `name` field values: diff --git a/content/200-orm/100-prisma-client/100-queries/100-query-optimization-performance.mdx b/content/200-orm/100-prisma-client/100-queries/100-query-optimization-performance.mdx index a33f3edf7a..e2b3476210 100644 --- a/content/200-orm/100-prisma-client/100-queries/100-query-optimization-performance.mdx +++ b/content/200-orm/100-prisma-client/100-queries/100-query-optimization-performance.mdx @@ -261,8 +261,8 @@ SELECT "public"."Post"."id", "public"."Post"."title" FROM "public"."Post" WHERE This is not an efficient way to query. Instead, you can: -- Use nested reads ([`include`](/reference/api-reference/prisma-client-reference#include) ) to return users and related posts -- Use the [`in`](/reference/api-reference/prisma-client-reference#in) filter +- Use nested reads ([`include`](/reference/api-reference/prisma-client-reference#include) ) to return users and related posts +- Use the [`in`](/reference/api-reference/prisma-client-reference#in) filter #### Solving n+1 with include @@ -326,10 +326,10 @@ SELECT "public"."Post"."id", "public"."Post"."createdAt", "public"."Post"."updat It is generally more performant to read and write large amounts of data in bulk - for example, inserting 50,000 records in batches of 1000 rather than as 50,000 separate inserts. Prisma Client supports the following bulk queries: -- [`createMany`](/reference/api-reference/prisma-client-reference#createmany) -- [`deleteMany`](/reference/api-reference/prisma-client-reference#deletemany) -- [`updateMany`](/reference/api-reference/prisma-client-reference#updatemany) -- [`findMany`](/reference/api-reference/prisma-client-reference#findmany) +- [`createMany`](/reference/api-reference/prisma-client-reference#createmany) +- [`deleteMany`](/reference/api-reference/prisma-client-reference#deletemany) +- [`updateMany`](/reference/api-reference/prisma-client-reference#updatemany) +- [`findMany`](/reference/api-reference/prisma-client-reference#findmany) ## Using select to limit number of columns returned diff --git a/content/200-orm/100-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx b/content/200-orm/100-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx index 832b6444f8..22df16e5ad 100644 --- a/content/200-orm/100-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx +++ b/content/200-orm/100-prisma-client/200-special-fields-and-types/080-null-and-undefined.mdx @@ -292,7 +292,7 @@ The following table provides a high-level overview of how the different operator | `AND` | return all items | validate single filter | validate all filters | | `NOT` | return all items | validate single filter | validate all filters | -This example shows how an `undefined` parameter impacts the results returned by a query that uses the [`OR`](/reference/api-reference/prisma-client-reference#or) operator. +This example shows how an `undefined` parameter impacts the results returned by a query that uses the [`OR`](/reference/api-reference/prisma-client-reference#or) operator. ```ts interface FormData { @@ -321,7 +321,7 @@ const users = await prisma.user.findMany({ The query receives filters from a formData object, which includes an optional email property. In this instance, the value of the email property is `undefined`. When this query is run no data is returned. -This is in contrast to the [`AND`](/reference/api-reference/prisma-client-reference#and) and [`NOT`](/reference/api-reference/prisma-client-reference#not-1) operators, which will both return all the users +This is in contrast to the [`AND`](/reference/api-reference/prisma-client-reference#and) and [`NOT`](/reference/api-reference/prisma-client-reference#not-1) operators, which will both return all the users if you pass in an `undefined` value. > This is because passing an `undefined` value to an `AND` or `NOT` operator is the same diff --git a/content/200-orm/100-prisma-client/200-special-fields-and-types/100-working-with-json-fields.mdx b/content/200-orm/100-prisma-client/200-special-fields-and-types/100-working-with-json-fields.mdx index ea7736e078..5dfc4e93ba 100644 --- a/content/200-orm/100-prisma-client/200-special-fields-and-types/100-working-with-json-fields.mdx +++ b/content/200-orm/100-prisma-client/200-special-fields-and-types/100-working-with-json-fields.mdx @@ -7,7 +7,7 @@ tocDepth: 3 -Use the [`Json`](/reference/api-reference/prisma-schema-reference#json) Prisma field type to read, write, and perform basic filtering on JSON types in the underlying database. In the following example, the `User` model has an optional `Json` field named `extendedPetsData`: +Use the [`Json`](/reference/api-reference/prisma-schema-reference#json) Prisma field type to read, write, and perform basic filtering on JSON types in the underlying database. In the following example, the `User` model has an optional `Json` field named `extendedPetsData`: ```prisma highlight=6;normal model User { @@ -255,9 +255,9 @@ const getUsers = await prisma.user.findMany({ The following string filters are available: -- [`string_contains`](/reference/api-reference/prisma-client-reference#string_contains) -- [`string_starts_with`](/reference/api-reference/prisma-client-reference#string_starts_with) -- [`string_ends_with`](/reference/api-reference/prisma-client-reference#string_ends_with) . +- [`string_contains`](/reference/api-reference/prisma-client-reference#string_contains) +- [`string_starts_with`](/reference/api-reference/prisma-client-reference#string_starts_with) +- [`string_ends_with`](/reference/api-reference/prisma-client-reference#string_ends_with) . ### Filter on nested object property @@ -418,9 +418,9 @@ const getUsers = await prisma.user.findMany({ The following array filters are available: -- [`array_contains`](/reference/api-reference/prisma-client-reference#array_contains) -- [`array_starts_with`](/reference/api-reference/prisma-client-reference#array_starts_with) -- [`array_ends_with`](/reference/api-reference/prisma-client-reference#array_ends_with) +- [`array_contains`](/reference/api-reference/prisma-client-reference#array_contains) +- [`array_starts_with`](/reference/api-reference/prisma-client-reference#array_starts_with) +- [`array_ends_with`](/reference/api-reference/prisma-client-reference#array_ends_with) ### Filtering on nested array value diff --git a/content/200-orm/100-prisma-client/200-special-fields-and-types/200-working-with-scalar-lists-arrays.mdx b/content/200-orm/100-prisma-client/200-special-fields-and-types/200-working-with-scalar-lists-arrays.mdx index 0251bd3567..e4369f9022 100644 --- a/content/200-orm/100-prisma-client/200-special-fields-and-types/200-working-with-scalar-lists-arrays.mdx +++ b/content/200-orm/100-prisma-client/200-special-fields-and-types/200-working-with-scalar-lists-arrays.mdx @@ -7,7 +7,7 @@ tocDepth: 3 -[Scalar lists](/reference/api-reference/prisma-schema-reference#-modifier) are represented by the `[]` modifier and are only available if the underlying database supports scalar lists. The following example has one scalar `String` list named `pets`: +[Scalar lists](/reference/api-reference/prisma-schema-reference#-modifier) are represented by the `[]` modifier and are only available if the underlying database supports scalar lists. The following example has one scalar `String` list named `pets`: , ]}> @@ -44,7 +44,7 @@ Example field value: ## Setting the value of a scalar list -The following example demonstrates how to [`set`](/reference/api-reference/prisma-client-reference#set-1) the value of a scalar list (`coinflips`) when you create a model: +The following example demonstrates how to [`set`](/reference/api-reference/prisma-client-reference#set-1) the value of a scalar list (`coinflips`) when you create a model: ```ts const createdUser = await prisma.user.create({ @@ -64,7 +64,7 @@ This method is available on MongoDB only in versions -The following example demonstrates how to [`unset`](/reference/api-reference/prisma-client-reference#unset) the value of a scalar list (`coinflips`): +The following example demonstrates how to [`unset`](/reference/api-reference/prisma-client-reference#unset) the value of a scalar list (`coinflips`): ```ts const createdUser = await prisma.user.create({ @@ -91,7 +91,7 @@ Available for: -Use the [`push`](/reference/api-reference/prisma-client-reference#push) method to add a single value to a scalar list: +Use the [`push`](/reference/api-reference/prisma-client-reference#push) method to add a single value to a scalar list: ```ts const userUpdate = await prisma.user.update({ @@ -145,7 +145,7 @@ Available for: -Use [scalar list filters](/reference/api-reference/prisma-client-reference#scalar-list-filters) to filter for records with scalar lists that match a specific condition. The following example returns all posts where the tags list includes `databases` _and_ `typescript`: +Use [scalar list filters](/reference/api-reference/prisma-client-reference#scalar-list-filters) to filter for records with scalar lists that match a specific condition. The following example returns all posts where the tags list includes `databases` _and_ `typescript`: ```ts const posts = await prisma.post.findMany({ diff --git a/content/200-orm/100-prisma-client/200-special-fields-and-types/300-working-with-composite-ids-and-constraints.mdx b/content/200-orm/100-prisma-client/200-special-fields-and-types/300-working-with-composite-ids-and-constraints.mdx index 3d2f160012..2ac52d4821 100644 --- a/content/200-orm/100-prisma-client/200-special-fields-and-types/300-working-with-composite-ids-and-constraints.mdx +++ b/content/200-orm/100-prisma-client/200-special-fields-and-types/300-working-with-composite-ids-and-constraints.mdx @@ -7,7 +7,7 @@ tocDepth: 2 -Composite IDs and compound unique constraints can be defined in your Prisma schema using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) and [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attributes. +Composite IDs and compound unique constraints can be defined in your Prisma schema using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) and [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attributes. diff --git a/content/200-orm/100-prisma-client/300-client-extensions/500-middleware/index.mdx b/content/200-orm/100-prisma-client/300-client-extensions/500-middleware/index.mdx index e8377ac882..354d71179e 100644 --- a/content/200-orm/100-prisma-client/300-client-extensions/500-middleware/index.mdx +++ b/content/200-orm/100-prisma-client/300-client-extensions/500-middleware/index.mdx @@ -16,7 +16,7 @@ Prisma Client extensions allow you to create independent Prisma Client instances -Middlewares act as query-level lifecycle hooks, which allow you to perform an action before or after a query runs. Use the [`prisma.$use`](/reference/api-reference/prisma-client-reference#use) method to add middleware, as follows: +Middlewares act as query-level lifecycle hooks, which allow you to perform an action before or after a query runs. Use the [`prisma.$use`](/reference/api-reference/prisma-client-reference#use) method to add middleware, as follows: ```ts highlight=4-9,12-17;normal const prisma = new PrismaClient() @@ -46,7 +46,7 @@ Do not invoke next multiple times within a middleware w -[`params`](/reference/api-reference/prisma-client-reference#params) represent parameters available in the middleware, such as the name of the query, and [`next`](/reference/api-reference/prisma-client-reference#next) represents [the next middleware in the stack _or_ the original Prisma Client query](#running-order-and-the-middleware-stack). +[`params`](/reference/api-reference/prisma-client-reference#params) represent parameters available in the middleware, such as the name of the query, and [`next`](/reference/api-reference/prisma-client-reference#next) represents [the next middleware in the stack _or_ the original Prisma Client query](#running-order-and-the-middleware-stack). Possible use cases for middleware include: diff --git a/content/200-orm/100-prisma-client/300-client-extensions/index.mdx b/content/200-orm/100-prisma-client/300-client-extensions/index.mdx index 7d7b0ee910..c1fb68819e 100644 --- a/content/200-orm/100-prisma-client/300-client-extensions/index.mdx +++ b/content/200-orm/100-prisma-client/300-client-extensions/index.mdx @@ -212,7 +212,7 @@ const xPrisma = prisma.$extends({ }) ``` -To learn more, see our documentation on [`$on`](/reference/api-reference/prisma-client-reference#on) and [`$use`](/reference/api-reference/prisma-client-reference#use) +To learn more, see our documentation on [`$on`](/reference/api-reference/prisma-client-reference#on) and [`$use`](/reference/api-reference/prisma-client-reference#use) ### Usage of client-level methods in extended clients diff --git a/content/200-orm/100-prisma-client/400-type-safety/100-operating-against-partial-structures-of-model-types.mdx b/content/200-orm/100-prisma-client/400-type-safety/100-operating-against-partial-structures-of-model-types.mdx index cacf078eab..20a7de5c01 100644 --- a/content/200-orm/100-prisma-client/400-type-safety/100-operating-against-partial-structures-of-model-types.mdx +++ b/content/200-orm/100-prisma-client/400-type-safety/100-operating-against-partial-structures-of-model-types.mdx @@ -99,7 +99,7 @@ The main benefits of the latter approach are: ### Description -When doing [`select`](/reference/api-reference/prisma-client-reference#select) or [`include`](/reference/api-reference/prisma-client-reference#include) operations on your models and returning these variants from a function, it can be difficult to gain access to the return type, e.g: +When doing [`select`](/reference/api-reference/prisma-client-reference#select) or [`include`](/reference/api-reference/prisma-client-reference#include) operations on your models and returning these variants from a function, it can be difficult to gain access to the return type, e.g: ```ts // Function definition that returns a partial structure diff --git a/content/200-orm/100-prisma-client/400-type-safety/99-prisma-validator.mdx b/content/200-orm/100-prisma-client/400-type-safety/99-prisma-validator.mdx index 11fbeed7f8..a5e05e2983 100644 --- a/content/200-orm/100-prisma-client/400-type-safety/99-prisma-validator.mdx +++ b/content/200-orm/100-prisma-client/400-type-safety/99-prisma-validator.mdx @@ -6,7 +6,7 @@ metaDescription: 'The Prisma validator is a utility function that takes a genera -The [`Prisma.validator`](/reference/api-reference/prisma-client-reference#prismavalidator) is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields. +The [`Prisma.validator`](/reference/api-reference/prisma-client-reference#prismavalidator) is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields. This page introduces the `Prisma.validator` and offers some motivations behind why you might choose to use it. diff --git a/content/200-orm/100-prisma-client/450-testing/150-integration-testing.mdx b/content/200-orm/100-prisma-client/450-testing/150-integration-testing.mdx index fd91087586..0fef3ce724 100644 --- a/content/200-orm/100-prisma-client/450-testing/150-integration-testing.mdx +++ b/content/200-orm/100-prisma-client/450-testing/150-integration-testing.mdx @@ -291,7 +291,7 @@ The following tests will check if the `createOrder` function works as it should - Creating an order with an existing customer - Show an "Out of stock" error message if a product doesn't exist -Before the test suite is run the database is seeded with data. After the test suite has finished a [`deleteMany`](/reference/api-reference/prisma-client-reference#deletemany) is used to clear the database of its data. +Before the test suite is run the database is seeded with data. After the test suite has finished a [`deleteMany`](/reference/api-reference/prisma-client-reference#deletemany) is used to clear the database of its data. diff --git a/content/200-orm/100-prisma-client/500-deployment/550-deploy-database-changes-with-prisma-migrate.mdx b/content/200-orm/100-prisma-client/500-deployment/550-deploy-database-changes-with-prisma-migrate.mdx index f05ca8337d..f07a5e5562 100644 --- a/content/200-orm/100-prisma-client/500-deployment/550-deploy-database-changes-with-prisma-migrate.mdx +++ b/content/200-orm/100-prisma-client/500-deployment/550-deploy-database-changes-with-prisma-migrate.mdx @@ -29,8 +29,8 @@ Ideally, `migrate deploy` should be part of an automated CI/CD pipeline, and we Beware that in order to run the `prisma migrate deploy` command, you need access to the `prisma` dependency that is typically added to the `devDependencies`. Some platforms like Vercel, prune development dependencies during the build, thereby preventing you from calling the command. This can be worked around by making the `prisma` a production dependency, by moving it to `dependencies` in your `package.json`. For more information about the `migrate deploy` command, see: -- [`migrate deploy` reference](/reference/api-reference/command-reference#migrate-deploy) -- [How `migrate deploy` works](/concepts/components/prisma-migrate/migrate-development-production#production-and-testing-environments) +- [`migrate deploy` reference](/reference/api-reference/command-reference#migrate-deploy) +- [How `migrate deploy` works](/concepts/components/prisma-migrate/migrate-development-production#production-and-testing-environments) - [Production troubleshooting](/guides/migrate/production-troubleshooting) diff --git a/content/200-orm/100-prisma-client/index.mdx b/content/200-orm/100-prisma-client/index.mdx index 88e18dd73e..57727d9708 100644 --- a/content/200-orm/100-prisma-client/index.mdx +++ b/content/200-orm/100-prisma-client/index.mdx @@ -143,7 +143,7 @@ const prisma = new PrismaClient() // use `prisma` in your application to read and write data in your DB ``` -The import path will depend on the custom `output` specified in Prisma Client's [`generator`](/reference/api-reference/prisma-schema-reference#fields-1) block in your Prisma schema. +The import path will depend on the custom `output` specified in Prisma Client's [`generator`](/reference/api-reference/prisma-schema-reference#fields-1) block in your Prisma schema. ### 4. Use Prisma Client to send queries to your database diff --git a/content/200-orm/200-prisma-migrate/050-getting-started.mdx b/content/200-orm/200-prisma-migrate/050-getting-started.mdx index 7465cc0d98..82bf859d44 100644 --- a/content/200-orm/200-prisma-migrate/050-getting-started.mdx +++ b/content/200-orm/200-prisma-migrate/050-getting-started.mdx @@ -7,7 +7,7 @@ tocDepth: 3 -This page explains how to get started with migrating your schema in a development environment using Prisma Migrate. See [Developing with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate) for a more in-depth development workflow. +This page explains how to get started with migrating your schema in a development environment using Prisma Migrate. See [Developing with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate) for a more in-depth development workflow. diff --git a/content/200-orm/200-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx b/content/200-orm/200-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx index b85694345d..bd7301fa69 100644 --- a/content/200-orm/200-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx +++ b/content/200-orm/200-prisma-migrate/200-understanding-prisma-migrate/200-shadow-database.mdx @@ -76,7 +76,7 @@ In some cases it might make sense (e.g. when [creating and dropping databases is 1. Create a dedicated database that should be used as the shadow database 2. Add the connection string of that database your environment variable `SHADOW_DATABASE_URL` (or `.env` file) -3. Add the [`shadowDatabaseUrl`](/reference/api-reference/prisma-schema-reference#datasource) field reading this environment variable: +3. Add the [`shadowDatabaseUrl`](/reference/api-reference/prisma-schema-reference#datasource) field reading this environment variable: ```prisma highlight=4;normal datasource db { @@ -94,7 +94,7 @@ Some cloud providers do not allow you to drop and create databases with SQL. Som 1. Create a dedicated cloud-hosted shadow database 2. Add the URL to your environment variable `SHADOW_DATABASE_URL` -3. Add the [`shadowDatabaseUrl`](/reference/api-reference/prisma-schema-reference#datasource) field reading this environment variable: +3. Add the [`shadowDatabaseUrl`](/reference/api-reference/prisma-schema-reference#datasource) field reading this environment variable: ```prisma highlight=4;normal datasource db { diff --git a/content/200-orm/200-prisma-migrate/300-workflows/110-native-database-types.mdx b/content/200-orm/200-prisma-migrate/300-workflows/110-native-database-types.mdx index 8352229c73..95d21284da 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/110-native-database-types.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/110-native-database-types.mdx @@ -14,8 +14,8 @@ Every¹ feature in your [data model](/concepts/components/prisma-schema/data-mod For a complete list of Prisma schema features, refer to: -- [Database features matrix](/reference/database-reference/database-features) for a list of database features and what they map to in the Prisma schema. -- [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for a list of all Prisma schema features, including field types, attributes, and functions. +- [Database features matrix](/reference/database-reference/database-features) for a list of database features and what they map to in the Prisma schema. +- [Prisma schema reference](/reference/api-reference/prisma-schema-reference) for a list of all Prisma schema features, including field types, attributes, and functions. Prisma Migrate also supports mapping each field to a [specific native type](#mapping-fields-to-a-specific-native-type), and there are ways to [include features without a Prisma schema equivalent in your database](#handling-unsupported-database-features). diff --git a/content/200-orm/200-prisma-migrate/300-workflows/120-native-database-functions.mdx b/content/200-orm/200-prisma-migrate/300-workflows/120-native-database-functions.mdx index b91eefbd1b..0b35f4c662 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/120-native-database-functions.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/120-native-database-functions.mdx @@ -6,7 +6,7 @@ metaDescription: How to enable PostgreSQL native database functions for projects -In PostgreSQL, some [native database functions](/concepts/components/prisma-schema/features-without-psl-equivalent#native-database-functions) are part of optional extensions. For example, in PostgreSQL versions 12.13 and earlier the `gen_random_uuid()` function is part of the [`pgcrypto`](https://www.postgresql.org/docs/10/pgcrypto.html) extension. +In PostgreSQL, some [native database functions](/concepts/components/prisma-schema/features-without-psl-equivalent#native-database-functions) are part of optional extensions. For example, in PostgreSQL versions 12.13 and earlier the `gen_random_uuid()` function is part of the [`pgcrypto`](https://www.postgresql.org/docs/10/pgcrypto.html) extension. To use a PostgreSQL extension, you must install it on the file system of your database server and then activate the extension. If you use Prisma Migrate, this must be done as part of a migration. diff --git a/content/200-orm/200-prisma-migrate/300-workflows/20-prototyping-your-schema.mdx b/content/200-orm/200-prisma-migrate/300-workflows/20-prototyping-your-schema.mdx index e6a654bff5..0847235dd6 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/20-prototyping-your-schema.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/20-prototyping-your-schema.mdx @@ -7,7 +7,7 @@ codeStyle: false -The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/reference/api-reference/command-reference#db-push) +The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/reference/api-reference/command-reference#db-push) `db push` uses the same engine as Prisma Migrate to synchronize your Prisma schema with your database schema. The `db push` command: @@ -33,7 +33,7 @@ The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/ref - You are prioritizing reaching a **desired end-state** and not the changes or steps executed to reach that end-state (there is no way to preview changes made by `db push`) - You do not need to control how schema changes impact data. There is no way to orchestrate schema and data migrations—if `db push` anticipates that changes will result in data loss, you can either accept data loss with the `--accept-data-loss` option or stop the process. There is no way to customize the changes. -See [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) for an example of how to use `db push` in this way. +See [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) for an example of how to use `db push` in this way. `db push` is **not recommended** if: @@ -44,7 +44,7 @@ See [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-pu ## Can I use Prisma Migrate and db push together? -Yes, you can [use `db push` and Prisma Migrate together in your development workflow](/guides/migrate/prototyping-schema-db-push) . For example, you can: +Yes, you can [use `db push` and Prisma Migrate together in your development workflow](/guides/migrate/prototyping-schema-db-push) . For example, you can: - Use `db push` to prototype a schema at the start of a project and initialize a migration history when you are happy with the first draft - Use `db push` to prototype a change to an existing schema, then run `prisma migrate dev` to generate a migration from your changes (you will be asked to reset) diff --git a/content/200-orm/200-prisma-migrate/300-workflows/70-patching-and-hotfixing.mdx b/content/200-orm/200-prisma-migrate/300-workflows/70-patching-and-hotfixing.mdx index 438f82c353..932eafcdb9 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/70-patching-and-hotfixing.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/70-patching-and-hotfixing.mdx @@ -126,8 +126,8 @@ The following example demonstrates how to manually complete the steps of a migra To help with fixing a failed migration, Prisma provides the following commands for creating and executing a migration file: -- [`prisma migrate diff`](/reference/api-reference/command-reference#migrate-diff) which diffs two database schema sources to create a migration taking one to the state of the second. You can output either a summary of the difference or a sql script. The script can be output into a file via `> file_name.sql` or be piped to the `db execute --stdin` command. -- [`prisma db execute`](/reference/api-reference/command-reference#db-execute) which applies a SQL script to the database without interacting with the Prisma migrations table. +- [`prisma migrate diff`](/reference/api-reference/command-reference#migrate-diff) which diffs two database schema sources to create a migration taking one to the state of the second. You can output either a summary of the difference or a sql script. The script can be output into a file via `> file_name.sql` or be piped to the `db execute --stdin` command. +- [`prisma db execute`](/reference/api-reference/command-reference#db-execute) which applies a SQL script to the database without interacting with the Prisma migrations table. These commands are available in Preview in versions `3.9.0` and later (with the `--preview-feature` CLI flag), and generally available in versions `3.13.0` and later. diff --git a/content/200-orm/200-prisma-migrate/300-workflows/80-unsupported-database-features.mdx b/content/200-orm/200-prisma-migrate/300-workflows/80-unsupported-database-features.mdx index fc7db82208..a9b83ad6fc 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/80-unsupported-database-features.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/80-unsupported-database-features.mdx @@ -6,7 +6,7 @@ metaDescription: How to include unsupported database features for projects that -Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features [cannot be represented in the Prisma schema](/concepts/components/prisma-schema/features-without-psl-equivalent) , including but not limited to: +Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features [cannot be represented in the Prisma schema](/concepts/components/prisma-schema/features-without-psl-equivalent) , including but not limited to: - Stored procedures - Triggers @@ -17,7 +17,7 @@ To add an unsupported feature to your database, you must [customize a migration] -The Prisma schema is able to represent [unsupported field types](/concepts/components/prisma-schema/features-without-psl-equivalent#unsupported-field-types) and [native database functions](enable-native-database-functions). +The Prisma schema is able to represent [unsupported field types](/concepts/components/prisma-schema/features-without-psl-equivalent#unsupported-field-types) and [native database functions](enable-native-database-functions). diff --git a/content/200-orm/200-prisma-migrate/300-workflows/90-development-and-production.mdx b/content/200-orm/200-prisma-migrate/300-workflows/90-development-and-production.mdx index e2a9669a2d..344e343b76 100644 --- a/content/200-orm/200-prisma-migrate/300-workflows/90-development-and-production.mdx +++ b/content/200-orm/200-prisma-migrate/300-workflows/90-development-and-production.mdx @@ -82,11 +82,11 @@ npx prisma migrate dev --create-only To apply the edited migration, run `prisma migrate dev` again. -Refer to [Customizing migrations](/guides/migrate/developing-with-prisma-migrate/customizing-migrations) for examples. +Refer to [Customizing migrations](/guides/migrate/developing-with-prisma-migrate/customizing-migrations) for examples. ### Team development -See: [Team development with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate/team-development) . +See: [Team development with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate/team-development) . ## Production and testing environments @@ -118,8 +118,8 @@ The `migrate deploy` command: See also: -- [Prisma Migrate in deployment](/guides/deployment/deploy-database-changes-with-prisma-migrate) -- [Production troubleshooting](/guides/migrate/production-troubleshooting) +- [Prisma Migrate in deployment](/guides/deployment/deploy-database-changes-with-prisma-migrate) +- [Production troubleshooting](/guides/migrate/production-troubleshooting) ### Advisory locking diff --git a/content/200-orm/200-prisma-migrate/index.mdx b/content/200-orm/200-prisma-migrate/index.mdx index 04106b1059..592a1645fe 100644 --- a/content/200-orm/200-prisma-migrate/index.mdx +++ b/content/200-orm/200-prisma-migrate/index.mdx @@ -28,11 +28,11 @@ Prisma Migrate can be considered a _hybrid_ database schema migration tool, mean -If you are prototyping, consider using the [`db push` command](db-push) - see [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) for examples. +If you are prototyping, consider using the [`db push` command](db-push) - see [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) for examples. -See the [Prisma Migrate reference](/reference/api-reference/command-reference#prisma-migrate) for detailed information about the Prisma Migrate CLI commands. +See the [Prisma Migrate reference](/reference/api-reference/command-reference#prisma-migrate) for detailed information about the Prisma Migrate CLI commands. diff --git a/content/200-orm/300-prisma-schema/10-overview/02-data-sources.mdx b/content/200-orm/300-prisma-schema/10-overview/02-data-sources.mdx index d36e7e64b3..c080432eaa 100644 --- a/content/200-orm/300-prisma-schema/10-overview/02-data-sources.mdx +++ b/content/200-orm/300-prisma-schema/10-overview/02-data-sources.mdx @@ -6,7 +6,7 @@ metaDescription: 'Data sources enable Prisma to connect to your database. This p -A data source determines how Prisma connects your database, and is represented by the [`datasource`](/reference/api-reference/prisma-schema-reference#datasource) block in the Prisma schema. The following data source uses the `postgresql` provider and includes a connection URL: +A data source determines how Prisma connects your database, and is represented by the [`datasource`](/reference/api-reference/prisma-schema-reference#datasource) block in the Prisma schema. The following data source uses the `postgresql` provider and includes a connection URL: ```prisma datasource db { diff --git a/content/200-orm/300-prisma-schema/10-overview/03-generators.mdx b/content/200-orm/300-prisma-schema/10-overview/03-generators.mdx index 1aef048592..fb369390f9 100644 --- a/content/200-orm/300-prisma-schema/10-overview/03-generators.mdx +++ b/content/200-orm/300-prisma-schema/10-overview/03-generators.mdx @@ -6,7 +6,7 @@ metaDescription: 'Generators in your Prisma schema specify what assets are gener -A Prisma schema can have one or more generators, represented by the [`generator`](/reference/api-reference/prisma-schema-reference#generator) block: +A Prisma schema can have one or more generators, represented by the [`generator`](/reference/api-reference/prisma-schema-reference#generator) block: ```prisma generator client { @@ -53,7 +53,7 @@ generator client { } ``` -In that case, Prisma detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/reference/api-reference/prisma-schema-reference#binarytargets-options) . +In that case, Prisma detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/reference/api-reference/prisma-schema-reference#binarytargets-options) . If you use macOS Intel x86 (`darwin`), then the binary file that was compiled for `darwin` will be selected. If you use macOS ARM64 (`darwin-arm64`), then the binary file that was compiled for `darwin-arm64` will be selected. diff --git a/content/200-orm/300-prisma-schema/20-data-model/10-models.mdx b/content/200-orm/300-prisma-schema/20-data-model/10-models.mdx index 6c562f6747..19ca03db87 100644 --- a/content/200-orm/300-prisma-schema/20-data-model/10-models.mdx +++ b/content/200-orm/300-prisma-schema/20-data-model/10-models.mdx @@ -126,8 +126,8 @@ enum Role { The data model definition is made up of: -- [Models](#defining-models) ([`model`](/reference/api-reference/prisma-schema-reference#model) primitives) that define a number of fields, including [relations between models](#relation-fields) -- [Enums](#defining-enums) ([`enum`](/reference/api-reference/prisma-schema-reference#enum) primitives) (if your connector supports Enums) +- [Models](#defining-models) ([`model`](/reference/api-reference/prisma-schema-reference#model) primitives) that define a number of fields, including [relations between models](#relation-fields) +- [Enums](#defining-enums) ([`enum`](/reference/api-reference/prisma-schema-reference#enum) primitives) (if your connector supports Enums) - [Attributes](#defining-attributes) and [functions](#using-functions) that change the behavior of fields and models The corresponding database looks like this: @@ -257,7 +257,7 @@ There are two ways to define a data model: ## Defining models -Models represent the entities of your application domain. Models are represented by [`model`](/reference/api-reference/prisma-schema-reference#model) blocks and define a number of [fields](/reference/api-reference/prisma-schema-reference#model-fields). In the [example data model](data-model), `User`, `Profile`, `Post` and `Category` are models. +Models represent the entities of your application domain. Models are represented by [`model`](/reference/api-reference/prisma-schema-reference#model) blocks and define a number of [fields](/reference/api-reference/prisma-schema-reference#model-fields). In the [example data model](data-model), `User`, `Profile`, `Post` and `Category` are models. A blogging platform can be extended with the following models: @@ -273,7 +273,7 @@ model Tag { ### Mapping model names to tables or collections -Prisma model [naming conventions (singular form, PascalCase)](/reference/api-reference/prisma-schema-reference#naming-conventions) do not always match table names in the database. A common approach for naming tables/collections in databases is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation - for example: `comments`. When you introspect a database with a table named `comments`, the result Prisma model will look like this: +Prisma model [naming conventions (singular form, PascalCase)](/reference/api-reference/prisma-schema-reference#naming-conventions) do not always match table names in the database. A common approach for naming tables/collections in databases is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation - for example: `comments`. When you introspect a database with a table named `comments`, the result Prisma model will look like this: ```prisma model comments { @@ -281,7 +281,7 @@ model comments { } ``` -However, you can still adhere to the naming convention without renaming the underlying `comments` table in the database by using the [`@@map`](/reference/api-reference/prisma-schema-reference#map-1) attribute: +However, you can still adhere to the naming convention without renaming the underlying `comments` table in the database by using the [`@@map`](/reference/api-reference/prisma-schema-reference#map-1) attribute: ```prisma model Comment { @@ -293,7 +293,7 @@ model Comment { With this model definition, Prisma automatically maps the `Comment` model to the `comments` table in the underlying database. -> **Note**: You can also [`@map`](/reference/api-reference/prisma-schema-reference#map) a column name or enum value, and `@@map` an enum name. +> **Note**: You can also [`@map`](/reference/api-reference/prisma-schema-reference#map) a column name or enum value, and `@@map` an enum name. `@map` and `@@map` allow you to [tune the shape of your Prisma Client API](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names#using-map-and-map-to-rename-fields-and-models-in-the-prisma-client-api) by decoupling model and field names from table and column names in the underlying database. @@ -314,14 +314,14 @@ With this model definition, Prisma automatically maps the `Comment` model to the The properties of a model are called _fields_, which consist of: -- A **[field name](/reference/api-reference/prisma-schema-reference#model-fields)** -- A **[field type](/reference/api-reference/prisma-schema-reference#model-fields)** +- A **[field name](/reference/api-reference/prisma-schema-reference#model-fields)** +- A **[field type](/reference/api-reference/prisma-schema-reference#model-fields)** - Optional **[type modifiers](#type-modifiers)** - Optional **[attributes](#defining-attributes)**, including [native database type attributes](#native-types-mapping) A field's type determines its _structure_, and fits into one of two categories: -- [Scalar types](data-model#scalar-fields) (includes [enums](data-model#defining-enums)) that map to columns (relational databases) or document fields (MongoDB) in the database - for example, [`String`](/reference/api-reference/prisma-schema-reference#string) or [`Int`](/reference/api-reference/prisma-schema-reference#int) +- [Scalar types](data-model#scalar-fields) (includes [enums](data-model#defining-enums)) that map to columns (relational databases) or document fields (MongoDB) in the database - for example, [`String`](/reference/api-reference/prisma-schema-reference#string) or [`Int`](/reference/api-reference/prisma-schema-reference#int) - Model types (the field is then called [relation field](relations#relation-fields)) - for example `Post` or `Comment[]`. The following table describes `User` model's fields from the sample schema: @@ -376,7 +376,7 @@ model Tag { -See [complete list of scalar field types](/reference/api-reference/prisma-schema-reference#model-field-scalar-types) . +See [complete list of scalar field types](/reference/api-reference/prisma-schema-reference#model-field-scalar-types) . ### Relation fields @@ -443,7 +443,7 @@ Type attributes are: Furthermore, during [Introspection](/concepts/components/introspection) type attributes are _only_ added to the schema if the underlying native type is **not the default type**. For example, if you are using the PostgreSQL provider, `String` fields where the underlying native type is `text` will not have a type attribute. -See [complete list of native database type attributes per scalar type and provider](/reference/api-reference/prisma-schema-reference#model-field-scalar-types) . +See [complete list of native database type attributes per scalar type and provider](/reference/api-reference/prisma-schema-reference#model-field-scalar-types) . #### Benefits and workflows @@ -454,8 +454,8 @@ See [complete list of native database type attributes per scalar type and provid The type of a field can be modified by appending either of two modifiers: -- [`[]`](/reference/api-reference/prisma-schema-reference#-modifier) Make a field a list -- [`?`](/reference/api-reference/prisma-schema-reference#-modifier-1) Make a field optional +- [`[]`](/reference/api-reference/prisma-schema-reference#-modifier) Make a field a list +- [`?`](/reference/api-reference/prisma-schema-reference#-modifier-1) Make a field optional > **Note**: You **cannot** combine type modifiers - optional lists are not supported. @@ -538,7 +538,7 @@ When **not** annotating a field with the `?` type modifier, the field will be _r ### Unsupported types -When you introspect a relational database, unsupported data types are added as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) : +When you introspect a relational database, unsupported data types are added as [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) : ```prisma location Unsupported("POLYGON")? @@ -554,7 +554,7 @@ Fields of type `Unsupported` are not available in the generated Prisma Client AP ## Defining attributes -Attributes modify the behavior of fields or model blocks. The following example includes three field attributes ([`@id`](/reference/api-reference/prisma-schema-reference#id) , [`@default`](/reference/api-reference/prisma-schema-reference#default) , and [`@unique`](/reference/api-reference/prisma-schema-reference#unique) ) and one block attribute ([`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) ): +Attributes modify the behavior of fields or model blocks. The following example includes three field attributes ([`@id`](/reference/api-reference/prisma-schema-reference#id) , [`@default`](/reference/api-reference/prisma-schema-reference#default) , and [`@unique`](/reference/api-reference/prisma-schema-reference#unique) ) and one block attribute ([`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) ): , ]}> @@ -589,13 +589,13 @@ model User { -Some attributes accept [arguments](/reference/api-reference/prisma-schema-reference#attribute-argument-types) - for example, `@default` accepts `true` or `false`: +Some attributes accept [arguments](/reference/api-reference/prisma-schema-reference#attribute-argument-types) - for example, `@default` accepts `true` or `false`: ```prisma isAdmin Boolean @default(false) // short form of @default(value: false) ``` -See [complete list of field and block attributes](/reference/api-reference/prisma-schema-reference#attributes) +See [complete list of field and block attributes](/reference/api-reference/prisma-schema-reference#attributes) ### Defining an ID field @@ -606,7 +606,7 @@ An ID uniquely identifies individual records of a model. A model can only have _ #### Defining IDs in relational databases -In relational databases, an ID can be defined by a single field using the [`@id`](/reference/api-reference/prisma-schema-reference#id) attribute, or multiple fields using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) attribute. +In relational databases, an ID can be defined by a single field using the [`@id`](/reference/api-reference/prisma-schema-reference#id) attribute, or multiple fields using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) attribute. ##### Single field IDs @@ -640,7 +640,7 @@ model User { By default, the name of this field in Prisma Client queries will be `firstName_lastName`. -You can also provide your own name for the composite ID using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) attribute's `name` field: +You can also provide your own name for the composite ID using the [`@@id`](/reference/api-reference/prisma-schema-reference#id-1) attribute's `name` field: ```prisma highlight=7;normal model User { @@ -684,7 +684,7 @@ You can optionally define a [custom primary key constraint name](/concepts/compo #### Defining IDs in MongoDB -The MongoDB connector has [specific rules for defining an ID field](/reference/api-reference/prisma-schema-reference#mongodb) that differs from relational databases. An ID must be defined by a single field using the [`@id`](/reference/api-reference/prisma-schema-reference#id) attribute and must include `@map("_id")`. +The MongoDB connector has [specific rules for defining an ID field](/reference/api-reference/prisma-schema-reference#mongodb) that differs from relational databases. An ID must be defined by a single field using the [`@id`](/reference/api-reference/prisma-schema-reference#id) attribute and must include `@map("_id")`. In the following example, the `User` ID is represented by the `id` string field that accepts an auto-generated `ObjectId`: @@ -721,7 +721,7 @@ MongoDB does not support composite IDs, which means you cannot identify a model ### Defining a default value -You can define default values for scalar fields of your models using the [`@default`](/reference/api-reference/prisma-schema-reference#default) attribute: +You can define default values for scalar fields of your models using the [`@default`](/reference/api-reference/prisma-schema-reference#default) attribute: , ]}> @@ -764,18 +764,18 @@ model Post { Default values can be: - Static values that correspond to the field type, such as `5` (`Int`), `Hello` (`String`), or `false` (`Boolean`) -- [Lists](/reference/api-reference/prisma-schema-reference#-modifier) of static values, such as `[5, 6, 8]` (`Int[]`) or `["Hello", "Goodbye"]` (`String`[]). These are available in versions `4.0.0` and later, when using databases where Prisma supports them (PostgreSQL, CockroachDB and MongoDB) +- [Lists](/reference/api-reference/prisma-schema-reference#-modifier) of static values, such as `[5, 6, 8]` (`Int[]`) or `["Hello", "Goodbye"]` (`String`[]). These are available in versions `4.0.0` and later, when using databases where Prisma supports them (PostgreSQL, CockroachDB and MongoDB) - [Functions](#using-functions), such as [`now()`](/reference/api-reference/prisma-schema-reference#now) or [`uuid()`](/reference/api-reference/prisma-schema-reference#uuid) -Refer to the [attribute function reference documentation](/reference/api-reference/prisma-schema-reference#attribute-functions) for information about connector support for functions. +Refer to the [attribute function reference documentation](/reference/api-reference/prisma-schema-reference#attribute-functions) for information about connector support for functions. ### Defining a unique field -You can add unique attributes to your models to be able to uniquely identify individual records of that model. Unique attributes can be defined on a single field using [`@unique`](/reference/api-reference/prisma-schema-reference#unique) attribute, or on multiple fields (also called composite or compound unique constraints) using the [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attribute. +You can add unique attributes to your models to be able to uniquely identify individual records of that model. Unique attributes can be defined on a single field using [`@unique`](/reference/api-reference/prisma-schema-reference#unique) attribute, or on multiple fields (also called composite or compound unique constraints) using the [`@@unique`](/reference/api-reference/prisma-schema-reference#unique-1) attribute. In the following example, the value of the `email` field must be unique: @@ -852,7 +852,7 @@ You can optionally define a [custom unique constraint name](/concepts/components By default, the name of this field in Prisma Client queries will be `authorId_title`. -You can also provide your own name for the composite unique constraint using the [`@@unique`](/concepts/components/prisma-schema/names-in-underlying-database#constraint-and-index-names) attribute's `name` field: +You can also provide your own name for the composite unique constraint using the [`@@unique`](/concepts/components/prisma-schema/names-in-underlying-database#constraint-and-index-names) attribute's `name` field: ```prisma highlight=10;normal model Post { @@ -919,7 +919,7 @@ model User { ### Defining an index -You can define indexes on one or multiple fields of your models via the [`@@index`](/reference/api-reference/prisma-schema-reference#index) on a model. The following example defines a multi-column index based on the `title` and `content` field: +You can define indexes on one or multiple fields of your models via the [`@@index`](/reference/api-reference/prisma-schema-reference#index) on a model. The following example defines a multi-column index based on the `title` and `content` field: ```prisma model Post { @@ -985,7 +985,7 @@ You can define enums in your data model [if enums are supported for your databas Enums are considered [scalar](#scalar-fields) types in the Prisma data model. They're therefore [by default](/concepts/components/prisma-client/select-fields#return-the-default-selection-set) included as return values in [Prisma Client queries](/concepts/components/prisma-client/crud). -Enums are defined via the [`enum`](/reference/api-reference/prisma-schema-reference#enum) block. For example, a `User` has a `Role`: +Enums are defined via the [`enum`](/reference/api-reference/prisma-schema-reference#enum) block. For example, a `User` has a `Role`: , ]}> @@ -1080,9 +1080,9 @@ Indexes can be defined by using the `@@index` attribute on the level of the mode ## Using functions -The Prisma schema supports a number of [functions](/reference/api-reference/prisma-schema-reference#attribute-functions) . These can be used to specify [default values](/reference/api-reference/prisma-schema-reference#default) on fields of a model. +The Prisma schema supports a number of [functions](/reference/api-reference/prisma-schema-reference#attribute-functions) . These can be used to specify [default values](/reference/api-reference/prisma-schema-reference#default) on fields of a model. -For example, the default value of `createdAt` is [`now()`](/reference/api-reference/prisma-schema-reference#now) : +For example, the default value of `createdAt` is [`now()`](/reference/api-reference/prisma-schema-reference#now) : , ]}> @@ -1107,9 +1107,9 @@ model Post { -[`cuid()`](/reference/api-reference/prisma-schema-reference#cuid) and [`uuid()`](/reference/api-reference/prisma-schema-reference#uuid) are implemented by Prisma and therefore are not "visible" in the underlying database schema. You can still use them when using [introspection](/concepts/components/introspection) by [manually changing your Prisma schema](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names) and [generating Prisma Client](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client), in that case the values will be generated by Prisma's [query engine](/concepts/components/prisma-engines/query-engine) +[`cuid()`](/reference/api-reference/prisma-schema-reference#cuid) and [`uuid()`](/reference/api-reference/prisma-schema-reference#uuid) are implemented by Prisma and therefore are not "visible" in the underlying database schema. You can still use them when using [introspection](/concepts/components/introspection) by [manually changing your Prisma schema](/concepts/components/prisma-client/working-with-prismaclient/use-custom-model-and-field-names) and [generating Prisma Client](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client), in that case the values will be generated by Prisma's [query engine](/concepts/components/prisma-engines/query-engine) -Support for [`autoincrement()`](/reference/api-reference/prisma-schema-reference#autoincrement) , [`now()`](/reference/api-reference/prisma-schema-reference#now) and [`dbgenerated()`](/reference/api-reference/prisma-schema-reference#dbgenerated) differ between databases. +Support for [`autoincrement()`](/reference/api-reference/prisma-schema-reference#autoincrement) , [`now()`](/reference/api-reference/prisma-schema-reference#now) and [`dbgenerated()`](/reference/api-reference/prisma-schema-reference#dbgenerated) differ between databases. **Relational database connectors** implement `autoincrement()`, `dbgenerated()`, and `now()` at database level. The **MongoDB connector** does not support `autoincrement()` or `dbgenerated()`, and `now()` is implemented at Prisma level. The [`auto()`](/reference/api-reference/prisma-schema-reference#auto) function is used to generate an `ObjectId`. @@ -1153,7 +1153,7 @@ const allUsers = await prisma.user.findMany() Prisma Client also generates **type definitions** that reflect your model structures. These are part of the generated [`@prisma/client`](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#the-prismaclient-npm-package) node module. -When using TypeScript, these type definitions ensure that all your database queries are entirely type safe and validated at compile-time (even partial queries using [`select`](/reference/api-reference/prisma-client-reference#select) or [`include`](/reference/api-reference/prisma-client-reference#include) ). +When using TypeScript, these type definitions ensure that all your database queries are entirely type safe and validated at compile-time (even partial queries using [`select`](/reference/api-reference/prisma-client-reference#select) or [`include`](/reference/api-reference/prisma-client-reference#include) ). Even when using plain JavaScript, the type definitions are still included in the `@prisma/client` node module, enabling features like [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense)/autocompletion in your editor. diff --git a/content/200-orm/300-prisma-schema/20-data-model/20-relations/index.mdx b/content/200-orm/300-prisma-schema/20-data-model/20-relations/index.mdx index 07b151ca1a..04fa24f9a8 100644 --- a/content/200-orm/300-prisma-schema/20-data-model/20-relations/index.mdx +++ b/content/200-orm/300-prisma-schema/20-data-model/20-relations/index.mdx @@ -458,7 +458,7 @@ Because a relation scalar field always _belongs_ to a relation field, the follow ## The @relation attribute -The [`@relation`](/reference/api-reference/prisma-schema-reference#relation) attribute can only be applied to the [relation fields](#relation-fields), not to [scalar fields](/concepts/components/prisma-schema/data-model#scalar-fields). +The [`@relation`](/reference/api-reference/prisma-schema-reference#relation) attribute can only be applied to the [relation fields](#relation-fields), not to [scalar fields](/concepts/components/prisma-schema/data-model#scalar-fields). The `@relation` attribute is required when: diff --git a/content/200-orm/300-prisma-schema/20-data-model/50-database-mapping.mdx b/content/200-orm/300-prisma-schema/20-data-model/50-database-mapping.mdx index e9f4d00a7b..00d582512f 100644 --- a/content/200-orm/300-prisma-schema/20-data-model/50-database-mapping.mdx +++ b/content/200-orm/300-prisma-schema/20-data-model/50-database-mapping.mdx @@ -20,7 +20,7 @@ The [Prisma schema](./) includes mechanisms that allow you to define names of ce Sometimes the names used to describe entities in your database might not match the names you would prefer in your generated API. Mapping names in the Prisma schema allows you to influence the naming in your Client API without having to change the underlying database names. -A common approach for naming tables/collections in databases for example is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation. Prisma on the other hand has recommended model [naming conventions (singular form, PascalCase)](/reference/api-reference/prisma-schema-reference#naming-conventions) which differ from that. +A common approach for naming tables/collections in databases for example is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation. Prisma on the other hand has recommended model [naming conventions (singular form, PascalCase)](/reference/api-reference/prisma-schema-reference#naming-conventions) which differ from that. `@map` and `@@map` allow you to [tune the shape of your Prisma Client API](../prisma-client/working-with-prismaclient/use-custom-model-and-field-names#using-map-and-map-to-rename-fields-and-models-in-the-prisma-client-api) by decoupling model and field names from table and column names in the underlying database. @@ -34,7 +34,7 @@ model comments { } ``` -However, you can still choose `Comment` as the name of the model (e.g. to follow the naming convention) without renaming the underlying `comments` table in the database by using the [`@@map`](/reference/api-reference/prisma-schema-reference#map-1) attribute: +However, you can still choose `Comment` as the name of the model (e.g. to follow the naming convention) without renaming the underlying `comments` table in the database by using the [`@@map`](/reference/api-reference/prisma-schema-reference#map-1) attribute: ```prisma highlight=4;normal model Comment { @@ -48,7 +48,7 @@ With this modified model definition, Prisma automatically maps the `Comment` mod ### Map field / column names -You can also [`@map`](/reference/api-reference/prisma-schema-reference#map) a column/field name: +You can also [`@map`](/reference/api-reference/prisma-schema-reference#map) a column/field name: ```prisma highlight=2-4;normal model Comment { diff --git a/content/200-orm/300-prisma-schema/20-data-model/70-unsupported-database-features.mdx b/content/200-orm/300-prisma-schema/20-data-model/70-unsupported-database-features.mdx index a65f19bded..ae0576756d 100644 --- a/content/200-orm/300-prisma-schema/20-data-model/70-unsupported-database-features.mdx +++ b/content/200-orm/300-prisma-schema/20-data-model/70-unsupported-database-features.mdx @@ -20,7 +20,7 @@ model Post { } ``` -However, you can also use **native database functions** to define default values with [`dbgenerated()`](/reference/api-reference/prisma-schema-reference#dbgenerated) on relational databases (MongoDB does not have the concept of database-level functions). The following example uses the PostgreSQL `gen_random_uuid()` function to populate the `id` field: +However, you can also use **native database functions** to define default values with [`dbgenerated()`](/reference/api-reference/prisma-schema-reference#dbgenerated) on relational databases (MongoDB does not have the concept of database-level functions). The following example uses the PostgreSQL `gen_random_uuid()` function to populate the `id` field: ```prisma model User { @@ -72,7 +72,7 @@ In earlier versions of Prisma, you must instead run a SQL command to activate th CREATE EXTENSION IF NOT EXISTS pgcrypto; ``` -If your project uses [Prisma Migrate](/concepts/components/prisma-migrate), you must [install the extension as part of a migration](/guides/migrate/developing-with-prisma-migrate/enable-native-database-functions) . Do not install the extension manually, because it is also required by the shadow database. +If your project uses [Prisma Migrate](/concepts/components/prisma-migrate), you must [install the extension as part of a migration](/guides/migrate/developing-with-prisma-migrate/enable-native-database-functions) . Do not install the extension manually, because it is also required by the shadow database. Prisma Migrate returns the following error if the extension is not available: @@ -83,7 +83,7 @@ Database error: Error querying the database: db error: ERROR: type "pgcrypto" do ## Unsupported field types -Some database types of relational databases, such as `polygon` or `geometry`, do not have a Prisma Schema Language equivalent. Use the [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) field type to represent the field in your Prisma schema: +Some database types of relational databases, such as `polygon` or `geometry`, do not have a Prisma Schema Language equivalent. Use the [`Unsupported`](/reference/api-reference/prisma-schema-reference#unsupported) field type to represent the field in your Prisma schema: ```prisma highlight=3;normal model Star { @@ -96,4 +96,4 @@ The `prisma migrate dev` and `prisma db push` command will both create a `positi ## Unsupported database features -Some features, like SQL views or partial indexes, cannot be represented in the Prisma schema. If your project uses [Prisma Migrate](/concepts/components/prisma-migrate), you must [include unsupported features as part of a migration](/guides/migrate/developing-with-prisma-migrate/include-unsupported-database-features) . +Some features, like SQL views or partial indexes, cannot be represented in the Prisma schema. If your project uses [Prisma Migrate](/concepts/components/prisma-migrate), you must [include unsupported features as part of a migration](/guides/migrate/developing-with-prisma-migrate/include-unsupported-database-features) . diff --git a/content/200-orm/300-prisma-schema/50-introspection.mdx b/content/200-orm/300-prisma-schema/50-introspection.mdx index 288be7bf86..c53e53f513 100644 --- a/content/200-orm/300-prisma-schema/50-introspection.mdx +++ b/content/200-orm/300-prisma-schema/50-introspection.mdx @@ -73,9 +73,9 @@ Prisma employs a number of conventions for translating a database schema into a Field, model and enum names (identifiers) must start with a letter and generally must only contain underscores, letters and digits. You can find the naming rules and conventions for each of these identifiers on the respective docs page: -- [Naming models](/reference/api-reference/prisma-schema-reference#naming-conventions) -- [Naming fields](/reference/api-reference/prisma-schema-reference#naming-conventions-1) -- [Naming enums](/reference/api-reference/prisma-schema-reference#naming-conventions-2) +- [Naming models](/reference/api-reference/prisma-schema-reference#naming-conventions) +- [Naming fields](/reference/api-reference/prisma-schema-reference#naming-conventions-1) +- [Naming enums](/reference/api-reference/prisma-schema-reference#naming-conventions-2) The general rule for identifiers is that they need to adhere to this regular expression: diff --git a/content/200-orm/400-tools/05-prisma-cli.mdx b/content/200-orm/400-tools/05-prisma-cli.mdx index 11641d3add..3ab712f00b 100644 --- a/content/200-orm/400-tools/05-prisma-cli.mdx +++ b/content/200-orm/400-tools/05-prisma-cli.mdx @@ -13,7 +13,7 @@ The Prisma command line interface (CLI) is the primary way to interact with your ## Command reference -See [Prisma CLI command reference](/reference/api-reference/command-reference) for a complete list of commands. +See [Prisma CLI command reference](/reference/api-reference/command-reference) for a complete list of commands. ## Installation 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 0533345d9f..51361cd3c5 100644 --- a/content/200-orm/500-reference/050-prisma-client-reference.mdx +++ b/content/200-orm/500-reference/050-prisma-client-reference.mdx @@ -63,7 +63,7 @@ This section describes the `PrismaClient` constructor and its parameters. ### datasources -Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/concepts/components/prisma-schema/data-sources) +Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/concepts/components/prisma-schema/data-sources) From version 5.2.0 and upwards, you can also use the [`datasourceUrl`](#datasourceUrl) property to programmatically override the database connection string. @@ -125,7 +125,7 @@ const prisma = new PrismaClient({ ### log -Determines the type and level of logging. See also: [Logging](/concepts/components/prisma-client/working-with-prismaclient/logging) +Determines the type and level of logging. See also: [Logging](/concepts/components/prisma-client/working-with-prismaclient/logging) #### Options @@ -378,7 +378,7 @@ const prisma = new PrismaClient({ ### adapter -Defines an instance of a [driver adapter](/concepts/components/database-drivers#driver-adapters). See also [Database drivers](/concepts/components/database-drivers) . +Defines an instance of a [driver adapter](/concepts/components/database-drivers#driver-adapters). See also [Database drivers](/concepts/components/database-drivers) . @@ -468,7 +468,7 @@ const prisma = new PrismaClient({ ## Model queries -Use model queries to perform CRUD operations on your models. See also: [CRUD](/concepts/components/prisma-client/crud) +Use model queries to perform CRUD operations on your models. See also: [CRUD](/concepts/components/prisma-client/crud) ### findUnique() @@ -1357,7 +1357,7 @@ const c = await prisma.user.count({ ### aggregate() -See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#aggregate) +See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#aggregate) #### Options @@ -1438,7 +1438,7 @@ const setValue = await prisma.user.aggregate({ ### groupBy() -See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#group-by) +See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#group-by) #### Options @@ -1521,7 +1521,7 @@ const groupUsers = await prisma.user.groupBy({ ### select -`select` defines which fields are included in the object that Prisma Client returns. See: [Select fields and include relations](/concepts/components/prisma-client/select-fields) . +`select` defines which fields are included in the object that Prisma Client returns. See: [Select fields and include relations](/concepts/components/prisma-client/select-fields) . #### Remarks @@ -1754,7 +1754,7 @@ const selectNameEmailNotPosts = Prisma.validator()({ ### include -`include` defines which relations are included in the result that Prisma Client returns. See: [Select fields and include relations](/concepts/components/prisma-client/select-fields) . +`include` defines which relations are included in the result that Prisma Client returns. See: [Select fields and include relations](/concepts/components/prisma-client/select-fields) . #### Remarks @@ -1954,7 +1954,7 @@ const whereEmailIsUnique = Prisma.validator()({ ### orderBy -Sorts a list of records. See also: [Sorting](/concepts/components/prisma-client/filtering-and-sorting) +Sorts a list of records. See also: [Sorting](/concepts/components/prisma-client/filtering-and-sorting) #### Remarks @@ -2454,7 +2454,7 @@ The following examples demonstrate how to use the [`validator`](/concepts/compon ### distinct -Deduplicate a list of records from [`findMany`](#findmany) or [`findFirst`](#findfirst). See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#select-distinct) +Deduplicate a list of records from [`findMany`](#findmany) or [`findFirst`](#findfirst). See also: [Aggregation, grouping, and summarizing](/concepts/components/prisma-client/aggregation-grouping-summarizing#select-distinct) #### Examples @@ -2569,13 +2569,13 @@ const distinctCitiesAndCountries = await prisma.user.findMany({ ### create -A nested `create` query adds a new related record or set of records to a parent record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) . +A nested `create` query adds a new related record or set of records to a parent record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) . #### Remarks - `create` is available as a nested query when you `create` (`prisma.user.create(...)`) a new parent record or `update` (`prisma.user.update(...)`) an existing parent record. -> You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [each technique pros and cons](/concepts/components/prisma-client/relation-queries#create-a-single-record-and-multiple-related-records) . +> You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [each technique pros and cons](/concepts/components/prisma-client/relation-queries#create-a-single-record-and-multiple-related-records) . #### Examples @@ -2670,7 +2670,7 @@ const user = await prisma.user.update({ ### createMany -A nested `createMany` query adds a new set of records to a parent record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) . +A nested `createMany` query adds a new set of records to a parent record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) . #### Remarks @@ -2680,7 +2680,7 @@ A nested `createMany` query adds a new set of records to a parent record. See: [ - Does not support nesting additional relations - you cannot nest an additional `create` or `createMany`. - Allows setting foreign keys directly - for example, setting the `categoryId` on a post. -> You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [each technique pros and cons](/concepts/components/prisma-client/relation-queries#create-a-single-record-and-multiple-related-records) . +> You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [each technique pros and cons](/concepts/components/prisma-client/relation-queries#create-a-single-record-and-multiple-related-records) . #### Examples @@ -2704,7 +2704,7 @@ const user = await prisma.user.update({ ### set -`set` overwrites the value of a relation - for example, replacing a list of `Post` records with a different list. See: [Working with relations](/concepts/components/prisma-client/relation-queries) +`set` overwrites the value of a relation - for example, replacing a list of `Post` records with a different list. See: [Working with relations](/concepts/components/prisma-client/relation-queries) #### Examples @@ -2725,7 +2725,7 @@ const user = await prisma.user.update({ -A nested `connect` query connects a record to an existing related record by specifying an ID or unique identifier. See: [Working with relations](/concepts/components/prisma-client/relation-queries) +A nested `connect` query connects a record to an existing related record by specifying an ID or unique identifier. See: [Working with relations](/concepts/components/prisma-client/relation-queries) #### Remarks @@ -2818,7 +2818,7 @@ const user = await prisma.user.update({ -`connectOrCreate` _either_ connects a record to an existing related record by ID or unique identifier _or_ creates a new related record if the record does not exist. See: [Working with relations](/concepts/components/prisma-client/relation-queries) +`connectOrCreate` _either_ connects a record to an existing related record by ID or unique identifier _or_ creates a new related record if the record does not exist. See: [Working with relations](/concepts/components/prisma-client/relation-queries) #### Remarks @@ -2986,7 +2986,7 @@ const user = await prisma.user.update({ -A nested `disconnect` query breaks the connection between a parent record and a related record, but does not delete either record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) +A nested `disconnect` query breaks the connection between a parent record and a related record, but does not delete either record. See: [Working with relations](/concepts/components/prisma-client/relation-queries) #### Remarks @@ -3032,7 +3032,7 @@ const user = await prisma.user.update({ -A nested `update` query updates one or more related records where the parent record's ID is `n`. See: [Working with relations](/concepts/components/prisma-client/relation-queries#update-a-specific-related-record) +A nested `update` query updates one or more related records where the parent record's ID is `n`. See: [Working with relations](/concepts/components/prisma-client/relation-queries#update-a-specific-related-record) #### Remarks @@ -4076,7 +4076,7 @@ Available for: ### Remarks -- Scalar list / array filters [ignore `NULL` values](/concepts/components/prisma-client/working-with-fields/working-with-scalar-lists-arrays#null-values-in-arrays) . Using `isEmpty` or `NOT` does not return records with `NULL` value lists / arrays, and `{ equals: null }` results in an error. +- Scalar list / array filters [ignore `NULL` values](/concepts/components/prisma-client/working-with-fields/working-with-scalar-lists-arrays#null-values-in-arrays) . Using `isEmpty` or `NOT` does not return records with `NULL` value lists / arrays, and `{ equals: null }` results in an error. ### has @@ -4631,11 +4631,11 @@ const updatePosts = await prisma.post.updateMany({ ## Json filters -For use cases and advanced examples, see: [Working with `Json` fields](/concepts/components/prisma-client/working-with-fields/working-with-json-fields) +For use cases and advanced examples, see: [Working with `Json` fields](/concepts/components/prisma-client/working-with-fields/working-with-json-fields). -Supported by [PostgreSQL](/concepts/database-connectors/postgresql) and [MySQL](/concepts/database-connectors/mysql) with different syntaxes for the `path` option. PostgreSQL does not support filtering on object key values in arrays. +Supported by [PostgreSQL](/concepts/database-connectors/postgresql) and [MySQL](/concepts/database-connectors/mysql) with different syntaxes for the `path` option. PostgreSQL does not support filtering on object key values in arrays. @@ -5025,7 +5025,7 @@ const getUsers = await prisma.user.findMany({ ### Remarks -- `$on` and `$use` client methods do not exist on extended client instances which are extended using [`$extends`](#extends) +- `$on` and `$use` client methods do not exist on extended client instances which are extended using [`$extends`](#extends) @@ -5069,7 +5069,7 @@ The `$on()` method allows you to subscribe to [logging events](#log) or the [exi -The `$use()` method adds [middleware](/concepts/components/prisma-client/middleware) : +The `$use()` method adds [middleware](/concepts/components/prisma-client/middleware) : ```ts prisma.$use(async (params, next) => { @@ -5116,7 +5116,7 @@ Example parameter values: #### Examples -See [middleware examples](/concepts/components/prisma-client/middleware#samples) . +See [middleware examples](/concepts/components/prisma-client/middleware#samples) . ### $executeRaw() @@ -5160,7 +5160,7 @@ Utility types are helper functions and types that live on the Prisma namespace. ### Prisma.validator -The `validator` helps you create re-usable query parameters based on your schema models while making sure that the objects you create are valid. See also: [Using `Prisma.validator`](/concepts/components/prisma-client/advanced-type-safety/prisma-validator) +The `validator` helps you create re-usable query parameters based on your schema models while making sure that the objects you create are valid. See also: [Using `Prisma.validator`](/concepts/components/prisma-client/advanced-type-safety/prisma-validator) There are two ways you can use the `validator`: @@ -5176,7 +5176,7 @@ Prisma.validator({ args }) When using the selector pattern, you use an existing Prisma Client instance to create a validator. This pattern allows you to select the model, operation, and query option to validate against. -You can also use an instance of Prisma Client that has been extended using a [Prisma Client extension](/concepts/components/prisma-client/client-extensions). +You can also use an instance of Prisma Client that has been extended using a [Prisma Client extension](/concepts/components/prisma-client/client-extensions). ```ts Prisma.validator( diff --git a/content/200-orm/500-reference/100-prisma-schema-reference.mdx b/content/200-orm/500-reference/100-prisma-schema-reference.mdx index 5662cacf64..84a5e9d79c 100644 --- a/content/200-orm/500-reference/100-prisma-schema-reference.mdx +++ b/content/200-orm/500-reference/100-prisma-schema-reference.mdx @@ -8,7 +8,7 @@ toc: true ## datasource -Defines a [data source](/concepts/components/prisma-schema/data-sources) in the Prisma schema. +Defines a [data source](/concepts/components/prisma-schema/data-sources) in the Prisma schema. ### Fields @@ -158,7 +158,7 @@ The format for connection strings is the same as for PostgreSQL. Learn more abou -Defines a [generator](/concepts/components/prisma-schema/generators) in the Prisma schema. +Defines a [generator](/concepts/components/prisma-schema/generators) in the Prisma schema. ### Fields @@ -166,7 +166,7 @@ A `generator` block accepts the following fields: | Name | Required | Type | Description | | ----------------- | -------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | -| `provider` | **Yes** | String (file path) or Enum (`prisma-client-js`) | Describes which [generator](/concepts/components/prisma-schema/generators) to use. This can point to a file that implements a generator or specify a built-in generator directly. | +| `provider` | **Yes** | String (file path) or Enum (`prisma-client-js`) | Describes which [generator](/concepts/components/prisma-schema/generators) to use. This can point to a file that implements a generator or specify a built-in generator directly. | | `output` | No | String (file path) | Determines the location for the generated client, [learn more](/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#using-a-custom-output-path). **Default**: `node_modules/.prisma/client` | | `previewFeatures` | No | List of Enums | Use intellisense to see list of currently available Preview features (`Ctrl+Space` in Visual Studio Code) **Default**: none | | | `engineType` | No | Enum (`library` or `binary`) | Defines the [query engine](/concepts/components/prisma-engines/query-engine) type to download and use. **Default**: `library` | @@ -329,7 +329,7 @@ generator client { ## model -Defines a Prisma [model](/concepts/components/prisma-schema/data-model#defining-models) . +Defines a Prisma [model](/concepts/components/prisma-schema/data-model#defining-models) . ### Remarks @@ -382,7 +382,7 @@ model User { ## model fields -[Fields](/concepts/components/prisma-schema/data-model#defining-fields) are properties of models. +[Fields](/concepts/components/prisma-schema/data-model#defining-fields) are properties of models. ### Remarks @@ -398,7 +398,7 @@ model User { The _data source connector_ determines what _native database type_ each of Prisma scalar type maps to. Similarly, the _generator_ determines what _type in the target programming language_ each of these types map to. -Prisma models also have [model field types](/concepts/components/prisma-schema/relations) that define relations between models. +Prisma models also have [model field types](/concepts/components/prisma-schema/relations) that define relations between models. ### String @@ -1667,7 +1667,7 @@ const post = await prisma.post.create({ -Defines a [default value for a field](/concepts/components/prisma-schema/data-model#defining-a-default-value) . +Defines a [default value for a field](/concepts/components/prisma-schema/data-model#defining-a-default-value) . #### Remarks @@ -2190,7 +2190,7 @@ model User { ### @@unique -Defines a compound [unique constraint](/concepts/components/prisma-schema/data-model#defining-a-unique-field) for the specified fields. +Defines a compound [unique constraint](/concepts/components/prisma-schema/data-model#defining-a-unique-field) for the specified fields. #### Remarks @@ -3350,7 +3350,7 @@ The [SQLite connector](/concepts/database-connectors/sqlite) and the The [Micros -Defines an [enum](/concepts/components/prisma-schema/data-model#defining-enums) . +Defines an [enum](/concepts/components/prisma-schema/data-model#defining-enums) . ### Remarks @@ -3449,7 +3449,7 @@ Composite types are available in versions 3.12.0 and later, and in versions 3.10 -Defines a [composite type](/concepts/components/prisma-schema/data-model#defining-composite-types) . +Defines a [composite type](/concepts/components/prisma-schema/data-model#defining-composite-types) . ### Naming conventions 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 07f51a2cef..07595be13d 100644 --- a/content/200-orm/500-reference/200-prisma-cli-reference.mdx +++ b/content/200-orm/500-reference/200-prisma-cli-reference.mdx @@ -856,8 +856,8 @@ This command is a good choice when you do not need to version schema changes, su See also: -- [Conceptual overview of `db push` and when to use it over Prisma Migrate](/concepts/components/prisma-migrate/db-push) -- [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) +- [Conceptual overview of `db push` and when to use it over Prisma Migrate](/concepts/components/prisma-migrate/db-push) +- [Schema prototyping with `db push`](/guides/migrate/prototyping-schema-db-push) #### Prerequisites @@ -911,7 +911,7 @@ prisma db push --schema=/tmp/schema.prisma `db seed` changed from Preview to Generally Available (GA) in 3.0.1. -See [Seeding your database](/guides/migrate/seed-database) +See [Seeding your database](/guides/migrate/seed-database) #### Options @@ -951,7 +951,7 @@ The output of the command is connector-specific, and is not meant for returning See also: -- [Migration troubleshooting in production](/guides/migrate/production-troubleshooting#fixing-failed-migrations-with-migrate-diff-and-db-execute) +- [Migration troubleshooting in production](/guides/migrate/production-troubleshooting#fixing-failed-migrations-with-migrate-diff-and-db-execute) #### Prerequisites @@ -1033,8 +1033,8 @@ This command is not supported on [MongoDB](/concepts/database-connectors/mongodb See also: -- [Conceptual overview of Prisma Migrate](/concepts/components/prisma-migrate) -- [Developing with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate) +- [Conceptual overview of Prisma Migrate](/concepts/components/prisma-migrate) +- [Developing with Prisma Migrate](/guides/migrate/developing-with-prisma-migrate) #### Options @@ -1275,7 +1275,7 @@ Both schema sources must use the same database provider. For example, a diff com See also: -- [Migration troubleshooting in production](/guides/migrate/production-troubleshooting#fixing-failed-migrations-with-migrate-diff-and-db-execute) +- [Migration troubleshooting in production](/guides/migrate/production-troubleshooting#fixing-failed-migrations-with-migrate-diff-and-db-execute) #### Prerequisites @@ -1424,7 +1424,7 @@ This is available from version 2.7.0 and later. The command used to populate the datasource is specified in the `prisma.seed` entry in the `package.json` file. It is used when `prisma db seed` is invoked or triggered. -See [Seeding your database](/guides/migrate/seed-database) +See [Seeding your database](/guides/migrate/seed-database) ```json file="package.json" { @@ -1444,5 +1444,5 @@ Prisma CLI supports [custom HTTP proxies](https://github.com/prisma/prisma/issue To activate usage of the proxy, provide either of the following environment variables: -- [`HTTP_PROXY`](/reference/api-reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080` -- [`HTTPS_PROXY`](/reference/api-reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080` +- [`HTTP_PROXY`](/reference/api-reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080` +- [`HTTPS_PROXY`](/reference/api-reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080` diff --git a/content/200-orm/800-more/100-under-the-hood/100-engines.mdx b/content/200-orm/800-more/100-under-the-hood/100-engines.mdx index 2b70af3bb8..70c4edcefc 100644 --- a/content/200-orm/800-more/100-under-the-hood/100-engines.mdx +++ b/content/200-orm/800-more/100-under-the-hood/100-engines.mdx @@ -38,11 +38,11 @@ You might want to use a [custom library or binary](https://github.com/prisma/pri Use the following environment variables to specify custom locations for your binaries: -- [`PRISMA_QUERY_ENGINE_LIBRARY`](/reference/api-reference/environment-variables-reference#prisma_query_engine_library) (Query engine, library) -- [`PRISMA_QUERY_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_query_engine_binary) (Query engine, binary) -- [`PRISMA_SCHEMA_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_schema_engine_binary) (Schema engine) -- [`PRISMA_MIGRATION_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_migration_engine_binary) (Migration engine) -- [`PRISMA_INTROSPECTION_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_introspection_engine_binary) (Introspection engine) +- [`PRISMA_QUERY_ENGINE_LIBRARY`](/reference/api-reference/environment-variables-reference#prisma_query_engine_library) (Query engine, library) +- [`PRISMA_QUERY_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_query_engine_binary) (Query engine, binary) +- [`PRISMA_SCHEMA_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_schema_engine_binary) (Schema engine) +- [`PRISMA_MIGRATION_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_migration_engine_binary) (Migration engine) +- [`PRISMA_INTROSPECTION_ENGINE_BINARY`](/reference/api-reference/environment-variables-reference#prisma_introspection_engine_binary) (Introspection engine) @@ -150,7 +150,7 @@ Introspection Engine : introspection-core d6ff7119649922b84e413b3b69660e2f49e2dd ### Hosting engines -The [`PRISMA_ENGINES_MIRROR`](/reference/api-reference/environment-variables-reference#prisma_engines_mirror) environment variable allows you to host engine files via a private server, AWS bucket or other cloud storage. +The [`PRISMA_ENGINES_MIRROR`](/reference/api-reference/environment-variables-reference#prisma_engines_mirror) environment variable allows you to host engine files via a private server, AWS bucket or other cloud storage. This can be useful if you have a custom OS that requires custom-built engines. ```terminal diff --git a/content/200-orm/800-more/600-help-and-troubleshooting/050-creating-bug-reports.mdx b/content/200-orm/800-more/600-help-and-troubleshooting/050-creating-bug-reports.mdx index 2b7421c536..4e09ee1be6 100644 --- a/content/200-orm/800-more/600-help-and-troubleshooting/050-creating-bug-reports.mdx +++ b/content/200-orm/800-more/600-help-and-troubleshooting/050-creating-bug-reports.mdx @@ -138,7 +138,7 @@ Default Engines Hash : 60cc71d884972ab4e897f0277c4b84383dddaf6c Studio : 0.379.0 ``` -Additionally, you can use the [`prisma debug`](/reference/api-reference/command-reference#debug) command to retrieve debugging information. The `prisma debug` command provides debugging information that compliments the output of the `prisma -v` command. The information includes [environment variables](/reference/api-reference/environment-variables-reference) used for Prisma Client, Prisma Migrate, Prisma CLI, and Prisma Studio. +Additionally, you can use the [`prisma debug`](/reference/api-reference/command-reference#debug) command to retrieve debugging information. The `prisma debug` command provides debugging information that compliments the output of the `prisma -v` command. The information includes [environment variables](/reference/api-reference/environment-variables-reference) used for Prisma Client, Prisma Migrate, Prisma CLI, and Prisma Studio.