From d6b1bb3dd5f7411b9c5be915766e90bc808991c1 Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Thu, 7 Aug 2025 15:40:16 +0200 Subject: [PATCH 01/11] update docs for sql views --- .../20-data-model/40-views.mdx | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index c99befd7b4..fa0d85140c 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -12,17 +12,16 @@ Database views allow you to name and store queries. In relational databases, vie The `views` preview feature allows you to represent views in your Prisma schema with the `view` keyword. To use views in Prisma ORM, follow these steps: -- [Enable the `views` preview feature](#enable-the-views-preview-feature) -- [Create a view in the underlying database](#create-a-view-in-the-underlying-database), either directly or as a [manual addition to a Prisma Migrate migration file](#use-views-with-prisma-migrate-and-db-push), or use an existing view -- [Represent the view in your Prisma schema](#add-views-to-your-prisma-schema) -- [Query the view in Prisma Client](#query-views-in-prisma-client) +1. [Enable the `views` preview feature](#enable-the-views-preview-feature) +1. [Create a view in the underlying database](#create-a-view-in-the-underlying-database), either directly or as a [manual addition to a Prisma Migrate migration file](#use-views-with-prisma-migrate-and-db-push), or use an existing view +1. [Represent the view in your Prisma schema](#add-views-to-your-prisma-schema) +1. [Query the view in Prisma Client](#query-views-in-prisma-client) :::warning Support for views is currently a [Preview](/orm/more/releases#preview) feature. You can add a view to your Prisma schema with the `view` keyword or introspect the views in your database schema with `db pull`. You cannot yet apply views in your schema to your database with Prisma Migrate and `db push` unless the changes are added manually to your migration file using the `--create-only` flag.

For updates on progress with this feature, follow [our GitHub issue](https://github.com/prisma/prisma/issues/17335). - ::: ## Enable the `views` preview feature @@ -37,11 +36,11 @@ generator client { } ``` -Please leave feedback about this preview feature in our dedicated [preview feature feedback issue for `views`](https://github.com/prisma/prisma/issues/17335). +Please leave feedback about this preview feature in our dedicated preview feature [feedback issue](https://github.com/prisma/prisma/issues/17335) for `views`. ## Create a view in the underlying database -Currently, you cannot apply views that you define in your Prisma schema to your database with Prisma Migrate and `db push`. Instead, you must first create the view in the underlying database, either manually or [as part of a migration](#use-views-with-prisma-migrate-and-db-push). +Currently, you cannot apply views that you define in your Prisma schema to your database with Prisma Migrate or `db push`. Instead, you must first create the view in the underlying database, either manually or [as part of a migration](#use-views-with-prisma-migrate-and-db-push). For example, take the following Prisma schema with a `User` model and a related `Profile` model: @@ -293,7 +292,7 @@ const userinfo = await prisma.userInfo.findMany({ :::note -`findUnique`, cursor-based pagination, and writes (create/update/delete) are not supported on `views`. +Write queries (create/update/delete) are not supported on `views`. ::: @@ -320,24 +319,27 @@ Currently, Prisma ORM does not support materialized views. However, when you [ma In the future Prisma Client might support marking individual views as materialized and add a Prisma Client method to refresh the materialized view. Please comment on our [`views` feedback issue](https://github.com/prisma/prisma/issues/17335) with your use case. -Here's a **revised `## Restrictions` section** with **clarity on *why*** these limitations exist: - ## Restrictions -Prisma ORM treats all `view` blocks as **read-only representations of database queries** rather than true tables. Because of this, several restrictions apply to ensure Prisma Client remains consistent with the behavior of the underlying database: +Prisma ORM treats all `view` blocks as _read-only_ representations of database queries rather than true tables. Because of this, several restrictions apply to ensure Prisma Client remains consistent with the behavior of the underlying database: + +### No identifiers + +Views are virtual tables and do not have inherent primary keys. Hence, you cannot define `@id`, `@@id` attributes on a `view` block. + +### No indexes -### No identifiers or constraints +Because views are virtual tables, they also can't have indexes. Therefore, , `@index` and `@@index` are disallowed to be define don `view` blocks. -Views are virtual tables and do not have inherent primary keys or unique constraints. Adding artificial constraints would create invalid assumptions for Prisma Client and break queries like `findUnique`. Hence, you cannot define `@id`, `@unique`, `@@id`, `@@unique`, or `@index` attributes on a `view` block. +### Unsafe `@unique` attributes -### No relationships +While Prisma ORM does allow you to define `@unique` and `@@unique` attributes on views, the correctness of these unique contraints actually isn't enforced. This means that if you define a `@unique` attribute on a field on a view, there may be multiple records with the same values for that field in the underlying database. -Relationships in Prisma rely on foreign keys and referential integrity, which views do not enforce. Defining relationships on a view could mislead developers into thinking data integrity is guaranteed. Hence, the `@relation` attributes are not supported for views. +Neither the database nor Prisma ORM enforces the unique constraint expressed by that attributre. The purpose of the `@unique` attribute in this case is only to enable relationships across views as well as `findUnique` queries and cursor-based pagination in Prisma Client. ### Limited Prisma Client API Views do not store data themselves, so writes and operations requiring unique identifiers cannot be supported. Also: - Only `findMany` (with filters, ordering, and skip/take pagination) is available. -- `findUnique`, cursor-based pagination, and aggregate queries that depend on unique identifiers are **not supported**. - All write operations (`create`, `update`, `delete`, `upsert`) are disabled and not generated in the Prisma Client. \ No newline at end of file From 6547b29264e5b7505e5faaa030e0ea867b760609 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Thu, 7 Aug 2025 15:52:25 +0200 Subject: [PATCH 02/11] Update content/200-orm/100-prisma-schema/20-data-model/40-views.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- content/200-orm/100-prisma-schema/20-data-model/40-views.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index fa0d85140c..dc5d8c183e 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -329,7 +329,7 @@ Views are virtual tables and do not have inherent primary keys. Hence, you canno ### No indexes -Because views are virtual tables, they also can't have indexes. Therefore, , `@index` and `@@index` are disallowed to be define don `view` blocks. +Because views are virtual tables, they cannot have indexes. Therefore, `@index` and `@@index` cannot be defined on `view` blocks. ### Unsafe `@unique` attributes From 07b270a2eaaf1d8b6f681d576a029dc36a6c3695 Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Thu, 7 Aug 2025 15:54:24 +0200 Subject: [PATCH 03/11] add improvements --- .../200-orm/100-prisma-schema/20-data-model/40-views.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index fa0d85140c..5d5b45b7b5 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -333,9 +333,11 @@ Because views are virtual tables, they also can't have indexes. Therefore, , `@i ### Unsafe `@unique` attributes -While Prisma ORM does allow you to define `@unique` and `@@unique` attributes on views, the correctness of these unique contraints actually isn't enforced. This means that if you define a `@unique` attribute on a field on a view, there may be multiple records with the same values for that field in the underlying database. +While Prisma ORM lets you place `@unique` and `@@unique` attributes on views, the underlying database and Prisma do not enforce those constraints. Multiple rows can therefore share the same value for a supposedly unique field. -Neither the database nor Prisma ORM enforces the unique constraint expressed by that attributre. The purpose of the `@unique` attribute in this case is only to enable relationships across views as well as `findUnique` queries and cursor-based pagination in Prisma Client. +Neither the database nor Prisma ORM enforce the unique constraint expressed by that attribute. + +The purpose of the `@unique` attribute in this case is only to enable relationships across views as well as `findUnique` queries and cursor-based pagination in Prisma Client. ### Limited Prisma Client API From d971a7565644744ea6ca199b7330f1e1b47d3422 Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Thu, 7 Aug 2025 15:59:03 +0200 Subject: [PATCH 04/11] minor improvements --- .../100-prisma-schema/20-data-model/40-views.mdx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index 94942fd7b3..85d60c3230 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -222,9 +222,10 @@ Each _field_ of a `view` block represents a column in the query results of the v ### Use introspection - - Currently only available for PostgreSQL, MySQL, SQL Server and CockroachDB. - +:::warning +Currently views can only be introspected with PostgreSQL, MySQL, SQL Server and CockroachDB databases. If you are using another database provider, your views must be added manually. +::: + If you have an existing view or views defined in your database, [introspection](/orm/prisma-schema/introspection) will automatically generate `view` blocks in your Prisma schema that represent those views. @@ -270,14 +271,6 @@ FROM ); ``` -### Limitations - -#### Introspection - -Currently, introspection of views is only available for PostgreSQL, MySQL, SQL Server and CockroachDB. If you are using another database provider, your views must be added manually. - -This is a temporary limitation and support for introspection will be extended to the other supported datasource providers. - ## Query views in Prisma Client You can query views in Prisma Client in the same way that you query models. For example, the following query finds all users with a `name` of `'Alice'` in the `UserInfo` view defined above. From 95620a835b671aa700d04d5aee158b176830e1be Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Thu, 7 Aug 2025 16:10:16 +0200 Subject: [PATCH 05/11] minor improvements in view docs --- .../200-orm/100-prisma-schema/20-data-model/40-views.mdx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index 85d60c3230..45d502555a 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -247,9 +247,7 @@ view UserInfo { ``` :::warning - Please note for now `db pull` will only introspect views in your schema when using PostgreSQL, MySQL, SQL Server or CockroachDB. Support for this workflow will be extended to other database providers. - ::: #### The `views` directory @@ -332,9 +330,6 @@ Neither the database nor Prisma ORM enforce the unique constraint expressed by t The purpose of the `@unique` attribute in this case is only to enable relationships across views as well as `findUnique` queries and cursor-based pagination in Prisma Client. -### Limited Prisma Client API - -Views do not store data themselves, so writes and operations requiring unique identifiers cannot be supported. Also: +### Disabled write queries -- Only `findMany` (with filters, ordering, and skip/take pagination) is available. -- All write operations (`create`, `update`, `delete`, `upsert`) are disabled and not generated in the Prisma Client. \ No newline at end of file +All write operations (`create`, `update`, `delete`, `upsert`) are disabled and not generated in the Prisma Client. \ No newline at end of file From bf51ce625e52b806ba341aaef7d777d8b795f7fb Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Tue, 12 Aug 2025 11:51:04 +0200 Subject: [PATCH 06/11] polished view docs --- .../100-prisma-schema/20-data-model/40-views.mdx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx index 45d502555a..ab3467c8dd 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/40-views.mdx @@ -271,6 +271,12 @@ FROM ## Query views in Prisma Client +:::note + +Be sure to run `prisma generate` after updating your Prisma schema so that the `view` definitions become part of your Prisma Client API. + +::: + You can query views in Prisma Client in the same way that you query models. For example, the following query finds all users with a `name` of `'Alice'` in the `UserInfo` view defined above. ```ts @@ -283,7 +289,7 @@ const userinfo = await prisma.userInfo.findMany({ :::note -Write queries (create/update/delete) are not supported on `views`. +Write-queries (create/update/delete) are not supported on `views`. ::: @@ -294,7 +300,7 @@ This section describes how to use Prisma ORM with updatable and materialized vie ### Updatable views -Some databases support *updatable views* (e.g. [PostgreSQL](https://www.postgresql.org/docs/current/sql-createview.html#SQL-CREATEVIEW-UPDATABLE-VIEWS), [MySQL](https://dev.mysql.com/doc/refman/8.0/en/view-updatability.html), and [SQL Server](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-view-transact-sql?view=sql-server-ver16#updatable-views)). Updatable views allow creating, updating, or deleting entries if the underlying database supports such operations. +Some databases support _updatable views_ (e.g. [PostgreSQL](https://www.postgresql.org/docs/current/sql-createview.html#SQL-CREATEVIEW-UPDATABLE-VIEWS), [MySQL](https://dev.mysql.com/doc/refman/8.0/en/view-updatability.html), and [SQL Server](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-view-transact-sql?view=sql-server-ver16#updatable-views)). Updatable views allow creating, updating, or deleting entries if the underlying database supports such operations. Prisma ORM does not allow any mutations (create, update, delete) on views, regardless of the database's capabilities. This change provides guardrails to ensure that views are treated consistently as read-only entities within Prisma Client. As a result, methods to perform writes such as `create`, `update`, `delete`, or `upsert` are not generated for `view` blocks in your Prisma Client API. @@ -310,9 +316,9 @@ Currently, Prisma ORM does not support materialized views. However, when you [ma In the future Prisma Client might support marking individual views as materialized and add a Prisma Client method to refresh the materialized view. Please comment on our [`views` feedback issue](https://github.com/prisma/prisma/issues/17335) with your use case. -## Restrictions +## Limitations -Prisma ORM treats all `view` blocks as _read-only_ representations of database queries rather than true tables. Because of this, several restrictions apply to ensure Prisma Client remains consistent with the behavior of the underlying database: +Prisma ORM treats all `view` blocks as _read-only_ representations of database queries rather than true tables. Because of this, several limitations apply to ensure Prisma Client remains consistent with the behavior of the underlying database. ### No identifiers From 1d2afdc38ccc46316ed5e896c72b9e8fd2ecd9a0 Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Fri, 15 Aug 2025 11:01:30 +0200 Subject: [PATCH 07/11] update notes about query compiler in ga --- .../500-databases/200-database-drivers.mdx | 15 +- .../10-overview/03-generators.mdx | 16 +- .../115-connection-pool.mdx | 13 +- .../050-databases-connections/index.mdx | 13 +- .../300-no-rust-engine.mdx | 214 +++++++++++++++++- .../201-serverless/300-deploy-to-vercel.mdx | 2 +- .../500-deployment/400-module-bundlers.mdx | 13 +- ...aveats-when-deploying-to-aws-platforms.mdx | 13 +- .../700-deploy-to-a-different-os.mdx | 14 +- .../100-under-the-hood/100-engines.mdx | 14 +- 10 files changed, 277 insertions(+), 50 deletions(-) diff --git a/content/200-orm/050-overview/500-databases/200-database-drivers.mdx b/content/200-orm/050-overview/500-databases/200-database-drivers.mdx index 839ba9ea3d..915bb67d85 100644 --- a/content/200-orm/050-overview/500-databases/200-database-drivers.mdx +++ b/content/200-orm/050-overview/500-databases/200-database-drivers.mdx @@ -8,22 +8,25 @@ toc_max_heading_level: 4 ## Default built-in drivers -One of Prisma Client's components is the [Query Engine](/orm/more/under-the-hood/engines). The Query Engine is responsible for transforming Prisma Client queries into SQL statements. It connects to your database via TCP using built-in drivers that don't require additional setup. +One of Prisma Client's components is the [Query Engine](/orm/more/under-the-hood/engines) (which is implemented in Rust). The Query Engine is responsible for transforming Prisma Client queries into SQL statements. It connects to your database via TCP using built-in drivers that don't require additional setup. :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -> Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. + +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: diff --git a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx index 94b41b6373..641ae176b7 100644 --- a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx @@ -45,23 +45,27 @@ generator client { :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. + +When using Prisma ORM without Rust, the `binaryTargets` field is obsolete and not needed. -When using the `queryCompiler` Preview feature, the `binaryTargets` field is obsolete and not needed. +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: + The `prisma-client-js` generator uses several [engines](https://github.com/prisma/prisma-engines). Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s). The correct file is particularly important when [deploying](/orm/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment. diff --git a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx index 880bf40ecf..60498eaa7b 100644 --- a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx +++ b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx @@ -14,18 +14,21 @@ Relational database connectors use Prisma ORM's own connection pool, and the Mon :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. When using the `queryCompiler` Preview feature, the connection pool is maintained by the native JS database driver you're using. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. In this scenario, the connection pool is maintained by the native JS database driver you're using. + +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: diff --git a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx index 29ffce3063..bf4bc37735 100644 --- a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx +++ b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx @@ -267,18 +267,21 @@ If you consistently experience connection pool timeouts after configuring the re :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. When using the `queryCompiler` Preview feature, the connection pool size is set via the native JS driver you are using. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. In this scenario, the connection pool size is set via the native JS driver you are using. + +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: diff --git a/content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx b/content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx index 98bf1afd09..4823b55021 100644 --- a/content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx +++ b/content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx @@ -2,10 +2,9 @@ title: "No Rust engine" metaTitle: "Use Prisma ORM without Rust engines" metaDescription: "Learn how to use Prisma ORM without Rust engines" -sidebar_class_name: preview-badge --- -As of [v6.7.0](https://pris.ly/release/6.7.0), you can use Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on PostgreSQL, CockroachDB, Neon, MySQL, PlanetScale, SQLite, D1 & MS SQL Server databases. +As of [v6.15.0](https://pris.ly/release/6.15.0), usage of Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on PostgreSQL, CockroachDB, Neon, MySQL, PlanetScale, SQLite, D1 & MS SQL Server databases has been [Generally Available](/orm/more/releases#generally-available-ga). This page gives an overview of how to use this version of Prisma ORM. @@ -13,7 +12,8 @@ This page gives an overview of how to use this version of Prisma ORM. The main technical differences if you're using Prisma ORM without a Rust engine are: -- no `binaryTargets` and `engineType` fields on the `generator` block +- `engineType = "client"` field needs to be set on the on the `generator` block +- no `binaryTargets` on the `generator` block - no query engine binary that's downloaded into the directory with your generated Prisma Client - required usage of [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) for database connection management @@ -21,7 +21,207 @@ The main technical differences if you're using Prisma ORM without a Rust engine ### Prerequisites -- Prisma ORM v6.7.0 (or later) +- Prisma ORM v6.15.0 (or later) + +### 1. Set `engineType` on the `generator` block + +```prisma file=schema.prisma +generator client { + provider = "prisma-client-js" // or `prisma-client` + output = "../generated/prisma" + engineType = "client" // enable Prisma ORM without Rust +} +``` + +### 2. Re-generate Prisma Client + +To make the configuration take effect, you need re-generate Prisma Client: + +```terminal +npx prisma generate +``` + +### 3. Install the driver adapter + +Depending on the database you use, you need to install a different driver adapter library: + + + +```terminal +npm install @prisma/adapter-pg +``` + + +```terminal +npm install @prisma/adapter-better-sqlite3 +``` + + +```terminal +npm install @prisma/adapter-d1 +``` + + +```terminal +npm install @prisma/adapter-mariadb +``` + + +```terminal +npm install @prisma/adapter-planetscale +``` + + +```terminal +npm install @prisma/adapter-mssql +``` + + +```terminal +npm install @prisma/adapter-pg +``` + + +```terminal +npm install @prisma/adapter-neon +``` + + + +### 4. Instantiate Prisma Client + +Finally, instantiate Prisma Client which you can do using the driver adapter and the connection URL for the database instance you're using: + + + +```typescript +import { PrismaPg } from '@prisma/adapter-pg' +import { PrismaClient } from './generated/prisma' + +const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }) +const prisma = new PrismaClient({ adapter }) +``` + + +```typescript +import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3'; +import { PrismaClient } from './generated/prisma'; + +const adapter = new PrismaBetterSQLite3({ url: process.env.DATABASE_URL }) +const prisma = new PrismaClient({ adapter }); +``` + + +```typescript +import { PrismaClient } from '@prisma/client' +import { PrismaD1 } from '@prisma/adapter-d1' + +export interface Env { + DB: D1Database +} + +export default { + async fetch( + request: Request, + env: Env, + ctx: ExecutionContext + ): Promise { + const adapter = new PrismaD1(env.DB) + const prisma = new PrismaClient({ adapter }) + + // ... query your DB + }, +} +``` + + +```typescript +import { PrismaMariaDb } from '@prisma/adapter-mariadb'; +import { PrismaClient } from './generated/prisma'; + +const adapter = new PrismaMariaDb({ + host: "localhost", + port: 3306, + connectionLimit: 5 +}); +const prisma = new PrismaClient({ adapter }); +``` + + +```typescript +import { PrismaPlanetScale } from '@prisma/adapter-planetscale' +import { PrismaClient } from '@prisma/client' +import { fetch as undiciFetch } from 'undici' + +const adapter = new PrismaPlanetScale({ url: process.env.DATABASE_URL, fetch: undiciFetch }) +const prisma = new PrismaClient({ adapter }) +``` + + +```typescript +import { PrismaMSSQL } from '@prisma/adapter-mssql'; +import { PrismaClient } from './generated/prisma'; + +const sqlConfig = { + user: process.env.DB_USER, + password: process.env.DB_PASSWORD, + database: process.env.DB_NAME, + server: process.env.HOST, + pool: { + max: 10, + min: 0, + idleTimeoutMillis: 30000 + }, + options: { + encrypt: true, // for azure + trustServerCertificate: false // change to true for local dev / self-signed certs + } +} + +const adapter = new PrismaMSSQL(sqlConfig) +const prisma = new PrismaClient({ adapter }); +``` + + +```typescript +import { PrismaPg } from '@prisma/adapter-pg' +import { PrismaClient } from './generated/prisma' + +const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }) +const prisma = new PrismaClient({ adapter }) +``` + + +```typescript +import { PrismaClient } from '@prisma/client' +import { PrismaNeon } from '@prisma/adapter-neon' +import dotenv from 'dotenv' + +dotenv.config() +const connectionString = `${process.env.DATABASE_URL}` + +const adapter = new PrismaNeon({ connectionString }) +const prisma = new PrismaClient({ adapter }) +``` + + + + +### 5. Query your database + +If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed. + +## Usage with older versions (Preview) + +The Rust-free version of Prisma ORM has been in Preview from versions v6.7.0 to v.6.14.0. Expand below if you're using any of these versions and are unable to upgrade to the latest one. + +
+ +Expand to see instructions for Prisma ORM v6.7.0 to v6.14.0 + +### Prerequisites + +- Any Prisma ORM version between 6.7.0 and 6.14.0 ### 1. Set feature flags @@ -211,4 +411,8 @@ const prisma = new PrismaClient({ adapter }) ### 5. Query your database -If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed. \ No newline at end of file +If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed. + +
+ + diff --git a/content/200-orm/200-prisma-client/500-deployment/201-serverless/300-deploy-to-vercel.mdx b/content/200-orm/200-prisma-client/500-deployment/201-serverless/300-deploy-to-vercel.mdx index e0048b65e7..364fd8074c 100644 --- a/content/200-orm/200-prisma-client/500-deployment/201-serverless/300-deploy-to-vercel.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/201-serverless/300-deploy-to-vercel.mdx @@ -53,7 +53,7 @@ If you are using Prisma inside a monorepo (e.g., with TurboRepo) and deploying t For more details on how Prisma interacts with different bundlers like Webpack and Parcel, see our [Module bundlers](/orm/prisma-client/deployment/module-bundlers#overview) page. The usage of this plugin becomes obsolet if: -- you are using [Prisma ORM without Rust engines](/orm/prisma-client/setup-and-configuration/no-rust-engine) (via the `queryCompiler` feature flag) +- you are using [Prisma ORM without Rust engines](/orm/prisma-client/setup-and-configuration/no-rust-engine) (via `engineType = "client` on your `generator` block) - you are using the [new `prisma-client` generator](/orm/prisma-schema/overview/generators#prisma-client-preview) ### CI/CD workflows diff --git a/content/200-orm/200-prisma-client/500-deployment/400-module-bundlers.mdx b/content/200-orm/200-prisma-client/500-deployment/400-module-bundlers.mdx index c073ab87f7..af424270b9 100644 --- a/content/200-orm/200-prisma-client/500-deployment/400-module-bundlers.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/400-module-bundlers.mdx @@ -12,18 +12,21 @@ Since Prisma Client is not only based on JavaScript code, but also relies on the :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. When using the `queryCompiler` Preview feature, the connection pool is maintained by the native JS database driver you're using. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. + +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: diff --git a/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx b/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx index b9fa375abe..ef9cc5980e 100644 --- a/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx @@ -66,18 +66,21 @@ AWS Lambda defines an **deployment package upload limit**, which includes: :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. + +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: diff --git a/content/200-orm/200-prisma-client/500-deployment/700-deploy-to-a-different-os.mdx b/content/200-orm/200-prisma-client/500-deployment/700-deploy-to-a-different-os.mdx index c5fe8bba34..460d530489 100644 --- a/content/200-orm/200-prisma-client/500-deployment/700-deploy-to-a-different-os.mdx +++ b/content/200-orm/200-prisma-client/500-deployment/700-deploy-to-a-different-os.mdx @@ -9,21 +9,23 @@ Prisma Client depends on the [query engine](/orm/more/under-the-hood/engines) th :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -> Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. -::: +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. +::: The query engine is implemented in Rust and is used by Prisma Client in the form of executable binary files. The binary is downloaded when `prisma generate` is called. 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 649c79d66e..88211a72c7 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 @@ -16,23 +16,25 @@ This page covers relevant technical details about the query engine. :::note -As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature. +As of [v6.15.0](https://pris.ly/release/6.15.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine). -**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**: +**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**: ```prisma generator client { - provider = "prisma-client-js" - previewFeatures = ["queryCompiler", "driverAdapters"] + provider = "prisma-client-js" // or "prisma-client" + output = "../src/generated/prisma" + engineType = "client" // no Rust engine } ``` -Note that the [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) Preview feature is required alongside `queryCompiler`. +Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines. -You can [learn more](https://www.prisma.io/blog/rust-to-typescript-update-boosting-prisma-orm-performance) about the change on our blog. +You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog. ::: + ## Prisma engines At the core of each module, there typically is a [Prisma engine](https://github.com/prisma/prisma-engines) that implements the core set of functionality. Engines are implemented in [Rust](https://www.rust-lang.org/) and expose a low-level API that is used by the higher-level interfaces. From 604eb5968de83cad754ed292faea84adb48295ea Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Fri, 15 Aug 2025 12:41:17 +0200 Subject: [PATCH 08/11] update preview feature reference --- .../10-overview/03-generators.mdx | 17 ++++----- .../050-client-preview-features.mdx | 37 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx index 641ae176b7..1dc080e9f4 100644 --- a/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx +++ b/content/200-orm/100-prisma-schema/10-overview/03-generators.mdx @@ -18,7 +18,7 @@ A generator determines which assets are created when you run the `prisma generat There are two generators for Prisma Client: - `prisma-client-js`: Generates Prisma Client into `node_modules` -- `prisma-client` ([Preview](/orm/more/releases#preview)): Newer and more flexible version of `prisma-client-js` with ESM support; it outputs plain TypeScript code and _requires_ a custom `output` path (read more about it [here](https://www.prisma.io/blog/why-prisma-orm-generates-code-into-node-modules-and-why-it-ll-change)) +- `prisma-client`: Newer and more flexible version of `prisma-client-js` with ESM support; it outputs plain TypeScript code and _requires_ a custom `output` path (read more about it [here](https://www.prisma.io/blog/why-prisma-orm-generates-code-into-node-modules-and-why-it-ll-change)) Alternatively, you can configure any npm package that complies with our generator specification. @@ -65,7 +65,6 @@ You can [read about the performance and DX improvements](https://www.prisma.io/b ::: - The `prisma-client-js` generator uses several [engines](https://github.com/prisma/prisma-engines). Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s). The correct file is particularly important when [deploying](/orm/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment. @@ -89,23 +88,23 @@ If you use macOS ARM64 (`darwin-arm64`), then the binary file that was compiled > **Note**: The `native` binary target is the default. You can set it explicitly if you wish to include additional [binary targets](/orm/reference/prisma-schema-reference#binarytargets-options) for deployment to different environments. -## `prisma-client` (Preview) +## `prisma-client` The new `prisma-client` generator offers greater control and flexibility when using Prisma ORM across different JavaScript environments (such as ESM, Bun, Deno, ...). It generates Prisma Client into a custom directory in your application's codebase that's specified via the `output` field on the `generator` block. This gives you full visibility and control over the generated code. It also [splits](#output-splitting-and-importing-types) the generated Prisma Client library into multiple files. -Currently in [Preview](/orm/more/releases#preview), this generator ensures you can bundle your application code exactly the way you want, without relying on hidden or automatic behaviors. +This generator ensures you can bundle your application code exactly the way you want, without relying on hidden or automatic behaviors. Here are the main differences compared to `prisma-client-js`: -- Requires an `output` path; no “magic” generation into `node_modules` any more -- Does not load `.env` at run time; use `dotenv` or set environment variables manually +- Requires an `output` path; no "magic" generation into `node_modules` any more +- Doesn't load `.env` at runtime; use `dotenv` or set environment variables manually instead - Supports ESM and CommonJS via the `moduleFormat` field -- More flexible thanks to additional fields +- More flexible thanks to additional [fields](#field-reference) - Outputs plain TypeScript that's bundled just like the rest of your application code -The `prisma-client` generator will become the new default with Prisma ORM v7. +The `prisma-client` generator has been Generally Available since [v6.15.0](https://pris.ly/releases/6.15.0) will become the new default with Prisma ORM v7. ### Getting started @@ -142,7 +141,7 @@ Then `../src/generated/prisma` places the generated code in `src/generated/prism Generate Prisma Client by running: -```bash +```terminal npx prisma generate ``` diff --git a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx index ca11e228fb..8ef8e0d78f 100644 --- a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx +++ b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx @@ -4,32 +4,28 @@ metaTitle: "Prisma Client & Prisma schema" metaDescription: "Prisma Client and Prisma schema features that are currently in Preview." --- - - When we release a new Prisma Client or Prisma schema feature, it often starts in Preview so that you can test it and submit your feedback. After we improve the feature with your feedback and are satisfied with the internal test results, we promote the feature to general availability. For more information, see [ORM releases and maturity levels](/orm/more/releases). - - ## Currently active Preview features The following [Preview](/orm/more/releases#preview) feature flags are available for Prisma Client and Prisma schema: -| Feature | Released into Preview | Feedback issue | -| ------------------------------------------------------------------------------------- | :------------------------------------------------------------- | :-------------------------------------------------------------------: | -| [`metrics`](/orm/prisma-client/observability-and-logging/metrics) | [3.15.0](https://github.com/prisma/prisma/releases/tag/3.15.0) | [Submit feedback](https://github.com/prisma/prisma/issues/13579) | -| [`postgresqlExtensions`](/orm/prisma-schema/postgresql-extensions) | [4.5.0](https://github.com/prisma/prisma/releases/tag/4.5.0) | [Submit feedback](https://github.com/prisma/prisma/issues/15835) | -| [`views`](/orm/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) | -| `driverAdapters` | [5.4.0](https://github.com/prisma/prisma/releases/tag/5.4.0) | [Submit feedback](https://github.com/prisma/prisma/issues/3108) | -| `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) | -| `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) | -| `typedSql` | [5.19.0](https://github.com/prisma/prisma/releases/tag/5.19.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25106) | -| `strictUndefinedChecks` | [5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25271) | -| [`fullTextSearchPostgres`](/orm/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) | -| [`prisma-client`](/orm/prisma-schema/overview/generators#prisma-client-preview) | [6.6.0](https://pris.ly/release/6.6.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) | -| `queryCompiler` | [6.7.0](https://pris.ly/release/6.7.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) | -| `shardKeys` | [6.10.0](https://pris.ly/release/6.10.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) | +| Feature | Released into Preview | Feedback issue | +| ------------------------------------------------------------------------------- | :------------------------------------------------------------- | :-------------------------------------------------------------------: | +| [`metrics`](/orm/prisma-client/observability-and-logging/metrics) | [3.15.0](https://github.com/prisma/prisma/releases/tag/3.15.0) | [Submit feedback](https://github.com/prisma/prisma/issues/13579) | +| [`postgresqlExtensions`](/orm/prisma-schema/postgresql-extensions) | [4.5.0](https://github.com/prisma/prisma/releases/tag/4.5.0) | [Submit feedback](https://github.com/prisma/prisma/issues/15835) | +| [`views`](/orm/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) | +| `driverAdapters` | [5.4.0](https://github.com/prisma/prisma/releases/tag/5.4.0) | [Submit feedback](https://github.com/prisma/prisma/issues/3108) | +| `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) | +| `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) | +| `typedSql` | [5.19.0](https://github.com/prisma/prisma/releases/tag/5.19.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25106) | +| `strictUndefinedChecks` | [5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25271) | +| [`fullTextSearchPostgres`](/orm/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) | +| [`prisma-client`](/orm/prisma-schema/overview/generators#prisma-client-preview) | [6.6.0](https://pris.ly/release/6.6.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) | +| `queryCompiler` | [6.7.0](https://pris.ly/release/6.7.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) | +| `shardKeys` | [6.10.0](https://pris.ly/release/6.10.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) | To enable a Preview feature, [add the feature flag to the `generator` block](#enabling-a-prisma-client-preview-feature) in your `schema.prisma` file. [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108). @@ -54,12 +50,15 @@ To enable a Prisma Client Preview feature: 3. If you are using Visual Studio Code and the Preview feature is not available in your `.ts` file after generating Prisma Client, run the **TypeScript: Restart TS server** command. -## Preview features promoted to general availability +## Preview features promoted to General Availability In the list below, you can find a history of Prisma Client and Prisma schema features that were in Preview and are now in general availability. The features are sorted by the most recent version in which they were promoted to general availability. | Feature | Released into Preview | Released into General Availability | | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`driverAdapters`](/orm/overview/databases/database-drivers#driver-adapters) | [5.4.0](https://github.com/prisma/prisma/releases/tag/5.4.0) | [6.15.0](https://github.com/prisma/prisma/releases/tag/6.15.0) | +| [`queryCompiler`](/orm/prisma-client/setup-and-configuration/no-rust-engine) | [6.7.0](https://github.com/prisma/prisma/releases/tag/6.15.0) | [6.15.0](https://github.com/prisma/prisma/releases/tag/6.15.0) | +| [`multiSchema`](/orm/prisma-schema/data-model/multi-schema) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [6.13.0](https://github.com/prisma/prisma/releases/tag/6.13.0) | | [`prismaSchemaFolder`](/orm/prisma-schema/overview/location#multi-file-prisma-schema) | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [6.7.0](https://pris.ly/release/6.7.0) | | `omitApi` | [5.13.0](https://github.com/prisma/prisma/releases/tag/5.13.0) | [6.2.0](https://github.com/prisma/prisma/releases/tag/6.2.0) | | `jsonProtocol` | [4.11.0](https://github.com/prisma/prisma/releases/tag/4.11.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) | From 2514cca2133e7244f8abb6937aef7a1407f95c6d Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Mon, 18 Aug 2025 15:08:21 +0200 Subject: [PATCH 09/11] update management api guide --- content/800-guides/240-management-api.mdx | 41 +++++++++++------------ 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/content/800-guides/240-management-api.mdx b/content/800-guides/240-management-api.mdx index 4166906718..3b54bdfd7b 100644 --- a/content/800-guides/240-management-api.mdx +++ b/content/800-guides/240-management-api.mdx @@ -21,7 +21,7 @@ The two Cloudflare Workers in this guide are just reference examples. You would Similarly, the `npx create-db` CLI is a simple demo. In your product, you can trigger the same API calls from your own UI or onboarding flows to create a seamless experience for your users. ::: -## Core Concepts +## Core concepts Before diving into implementation, let's clarify the main concepts involved in the Management API integration: @@ -29,8 +29,8 @@ Before diving into implementation, let's clarify the main concepts involved in t - **Projects vs Databases**: A project is a container that can hold multiple databases. You can use this to organize databases you create e.g. by user. Projects can then be transferred to users, including all databases they contain. - **Authentication**: All API requests require authentication. As a partner, you use OAuth2 to obtain integration tokens (for your app) and facilitate secure transfers to your users. - **Tokens**: There are two main types of tokens: - - **Integration Token**: Issued to your partner integration, scoped to provision and manage databases on your own workspace. - - **User Access Token**: Obtained via OAuth2 when a user authenticates with your app, scoped to the user's workspace and can be used to transfer database ownership to the user's workspace. + - **Service token**: Issued to your partner integration, scoped to provision and manage databases on your own workspace. + - **OAuth 2 access token**: Obtained via OAuth2 when a user authenticates with your app, scoped to the user's workspace and can be used to transfer database ownership to the user's workspace. ## How to become a partner @@ -41,34 +41,31 @@ To use the Prisma Postgres Management API, you first need to set up as a partner For a complete list of available endpoints and details on request/response formats, see the [Prisma Management API documentation](/postgres/introduction/management-api). -## Provisioning a Database as a Partner +## Provisioning a database as a Partner To provision a new Prisma Postgres database for your users as a partner, follow these steps: 1. **Gather required information**: Prepare the necessary details for provisioning, such as region, database name, and any other options your application requires. This information may come from user input or be determined by your application logic. 2. **Authenticate your integration**: Use your integration token (obtained via OAuth2) to authenticate API requests. This token authenticates your app as an approved partner. 3. **Send a database provisioning request**: Make a `POST` request to the Management API endpoint to create a new project with a default database. For example: - -```ts -const prismaResponse = await fetch('https://api.prisma.io/v1/projects', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer `, - }, - body: JSON.stringify({ region, name }), -}); -``` - + ```ts + const prismaResponse = await fetch('https://api.prisma.io/v1/projects', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer `, + }, + body: JSON.stringify({ region, name }), + }); + ``` 4. **Handle the response**: If successful, the API will return the new project's details, including database connection strings and a `project_id`. Store these securely and display them to your user as needed. - 5. **(Optional) Store project metadata**: You may want to associate the `project_id` with your user in your own database for future reference. -## Database Claim Flow +## Database claim flow Once a database is provisioned, you may want to transfer ownership to your user at a later point so they can manage it in their own Prisma workspace and go beyond the free database usage limits. This is done via the claim flow, which consists of three main steps: -### Overview: How the Claim Flow Works +### Overview: How the claim flow works When a user wants to claim a database, your app will: @@ -78,7 +75,7 @@ When a user wants to claim a database, your app will: This ensures the transfer is secure and only the intended user can claim the database. -### 1. Triggering the Claim Flow +### 1. Triggering the claim flow When your user wants to take ownership of a database you provisioned for them, they need to transfer it to their own Prisma Postgres workspace. This gives them full control over it. @@ -102,11 +99,11 @@ const authUrl = `https://auth.prisma.io/authorize?${authParams.toString()}`; // Redirect the user to authUrl ``` -### 2. Authenticating the User +### 2. Authenticating the user The user will be prompted to log in (if not already authenticated) and select the workspace where they want to claim the database. After successful authentication and workspace selection, Prisma Auth will redirect back to your callback endpoint with a `code` and `state` (and, in some cases, a `project_id`). -### 3. Finishing the Claim Flow +### 3. Finishing the claim flow Your backend should now: From 1bdecb6a160842cc7ad5c2b064d53670b3a9f6ab Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Mon, 18 Aug 2025 15:53:22 +0200 Subject: [PATCH 10/11] reworked partner oauth section --- content/800-guides/240-management-api.mdx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/content/800-guides/240-management-api.mdx b/content/800-guides/240-management-api.mdx index 3b54bdfd7b..cd5dee9489 100644 --- a/content/800-guides/240-management-api.mdx +++ b/content/800-guides/240-management-api.mdx @@ -37,10 +37,22 @@ Before diving into implementation, let's clarify the main concepts involved in t To use the Prisma Postgres Management API, you first need to set up as a partner: 1. **Request access to the Management API**: Contact the Prisma team from the [Prisma Partners page](https://www.prisma.io/partners) to request access to the Management API. You will be guided through the onboarding process. -2. **Obtain OAuth credentials**: Once approved, you will receive an OAuth client ID and client secret. These credentials are required to authenticate your integration and enable secure database transfers for your users. +2. **Obtain OAuth credentials**: You can obtain your OAuth credentials in the [Prisma Console](https://console.prisma.io). See the [next section](#get-oauth-credentials) for details. For a complete list of available endpoints and details on request/response formats, see the [Prisma Management API documentation](/postgres/introduction/management-api). +## Get OAuth credentials + +To obtain a client ID and client secret, you need go through this flow: + +1. Open the [Prisma Console](https://console.prisma.io) +1. Click the 🧩 **Integrations** tab in the sidenav +1. In the **Published Applications** section, click **New Application** button to start the flow for creating a new OAuth app +1. Enter a **Name**, **Description** and **Callback URL** for your OAuth app. +1. Click **Continue**. + +On the next screen, you can access and save the client ID and client secret for your OAuth app. + ## Provisioning a database as a Partner To provision a new Prisma Postgres database for your users as a partner, follow these steps: From 12ea903475c19dd28e7551929132fe9ca9aac600 Mon Sep 17 00:00:00 2001 From: Nikolas Burk Date: Mon, 18 Aug 2025 15:56:59 +0200 Subject: [PATCH 11/11] add docs for creating oauth apps --- .../100-introduction/230-management-api.mdx | 14 ++++++++++++++ content/800-guides/240-management-api.mdx | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/content/250-postgres/100-introduction/230-management-api.mdx b/content/250-postgres/100-introduction/230-management-api.mdx index 987af41b83..2a4c0174ee 100644 --- a/content/250-postgres/100-introduction/230-management-api.mdx +++ b/content/250-postgres/100-introduction/230-management-api.mdx @@ -50,6 +50,8 @@ To adhere to the Bearer Token Authentication, you need to format your `Authoriza Authorization: Bearer $TOKEN ``` +#### Creating a service token + You can create a service token to use the Management API like this: 1. Open the [Prisma Console](https://console.prisma.io/). @@ -58,6 +60,18 @@ You can create a service token to use the Management API like this: 4. Click **New Service Token**. 5. Copy the generated token and store it in a safe location for future use. +#### Creating an OAuth credentials + +To obtain a client ID and client secret, go through this flow: + +1. Open the [Prisma Console](https://console.prisma.io). +1. Click the 🧩 **Integrations** tab in the sidenav. +1. In the **Published Applications** section, click **New Application** button to start the flow for creating a new OAuth app. +1. Enter a **Name**, **Description** and **Callback URL** for your OAuth app. +1. Click **Continue**. + +On the next screen, you can access and save the client ID and client secret for your OAuth app. + ### Example ```terminal diff --git a/content/800-guides/240-management-api.mdx b/content/800-guides/240-management-api.mdx index cd5dee9489..6c4d71dbb7 100644 --- a/content/800-guides/240-management-api.mdx +++ b/content/800-guides/240-management-api.mdx @@ -45,9 +45,9 @@ For a complete list of available endpoints and details on request/response forma To obtain a client ID and client secret, you need go through this flow: -1. Open the [Prisma Console](https://console.prisma.io) -1. Click the 🧩 **Integrations** tab in the sidenav -1. In the **Published Applications** section, click **New Application** button to start the flow for creating a new OAuth app +1. Open the [Prisma Console](https://console.prisma.io). +1. Click the 🧩 **Integrations** tab in the sidenav. +1. In the **Published Applications** section, click **New Application** button to start the flow for creating a new OAuth app. 1. Enter a **Name**, **Description** and **Callback URL** for your OAuth app. 1. Click **Continue**.