Prisma 4.5.0stable Released Oct 18, 2022
Impact Score: 5/10

Prisma 4.5.0 — Release Notes & Engineering Impact

Source available — automated, not human-reviewed

Component: prisma · Channel: stable. Automated analysis, not a compatibility certification. How this works.

Analysis updated: 2026-11-01.

Compatibility not verified — check source notes
$ npm install --save-dev --save-exact [email protected]
📄 .MD
⚡ Executive Summary (TL;DR)

Prisma 4.5.0. Source highlight: 🌟 **Help us spread the word about Prisma by starring the repo or tweeting about the release.** 🌟

Who Does This Impact? (Role-Based Analysis)

💻 Software Engineers & Devs

Check the source notes against the package and APIs you use before upgrading.

📊 Product & Engineering Leads

Use the documented changes to assess relevance to your product; release frequency alone is not a quality measure.

⚙️ DevOps & Security

Verify the target version, runtime requirements and rollback procedure in the official documentation.

✨ New Features & Capabilities (4)

  • Rename the feature to “Prisma relation mode” → relationMode
  • Add TS test for datasource property `referentialIntegrity` and `relationMode`
  • Feature: Allow non-unique fields to be used with update
  • Add autocompletion for property of `relationMode` (previously `referentialIntegrity`) in the datasource block
📄 View Raw Release Notes (Original Developer Log)
🌟 **Help us spread the word about Prisma by starring the repo or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20@prisma%20release%20v4.5.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.5.0) about the release.** 🌟 ## **Major improvements** ### Filter for non-unique properties in unique where queries (Preview) In this release, we are adding support for non-unique properties inside the `where` statement for queries that operate on a unique record (e.g.: `findUnique`, `update`, `delete`, etc.). This was not possible in the past, as we only allowed unique fields as filters inside the `where` statement for the queries in question. There are use cases where a query that operates on a unique record requires further filtering by non-unique properties. For example, for the following model: ```prisma model Article { id Int @id @default(autoincrement()) content String version Int } ``` Let’s say that you would like to update the `Article` with an `id` of “5”, **but only if the `version` equals "1":** ```ts await prisma.article.update({ where: { id: 5, version: 1 }, // `version` field was not available before Prisma 4.5.0 data: { content: "Incredible new story", version: { increment: 1 }, }, }); ``` With `4.5.0`, we are adding support to specify any number of non-unique fields in your `where` statement, as long as you have at least one unique field. To use it, enable the Preview feature flag: ```prisma generator js { provider = "prisma-client-js" previewFeatures = ["extendedWhereUnique"] } ``` To learn more about this feature and about use cases where it can be useful, please check out our [documentation](https://prisma.io/docs/reference/api-reference/prisma-client-reference#filter-on-non-unique-fields-with-userwhereuniqueinput). For feedback, please leave a comment on the GitHub [issue](https://github.com/prisma/prisma/issues/15837). ### PostgreSQL extension management (Preview) We are excited to add support for declaring PostgreSQL extensions in the Prisma schema. The feature comes with support for introspection and migrations. This will allow you to adopt, evolve and manage which PostgreSQL database extensions are installed directly from within your Prisma schema. > 💡 This feature adds support to manage PostgreSQL extensions in Prisma schema. It does not provide additional query capabilities and datatypes in Prisma Client. To try this feature, enable the Preview feature flag: ```prisma generator client { provider = "prisma-client-js" previewFeatures = ["postgresqlExtensions"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } ``` Now you will be able to use the new `extensions` property in the `datasource` block of your Prisma schema. ```prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") extensions = [hstore(schema: "myHstoreSchema"), pg_tgrm, postgis(version: "2.1")] } ``` > ⚠️ To avoid noise from introspection, we currently only introspect the following allow-list: `citext`, `pgcrypto`, `uuid-ossp`, and `postgis`. But you can add and configure any extension to your Prisma schema manually. Please visit our [documentation](https://prisma.io/docs/concepts/components/prisma-schema/postgresql-extensions) to learn more about this feature or leave a comment with feedback on the GitHub [issue](https://github.com/prisma/prisma/issues/15835). ### Change to Referential Integrity — property in `datasource` block renamed to `relationMode` (Preview) To prepare Prisma Client’s emulation of relations for general availability, we are releasing several improvements to the `referentialIntegrity` Preview feature. We decided to rename the feature to Relation Mode. We think this closer reflects what this feature does and distinguishes it from integrity management on the database level. The related property in the `datasource` block of the Prisma schema has also been changed from `referentialIntegrity` to `relationMode`. > ⚠️ The Preview feature flag inside the `generator` block of the Prisma schema is still called `referentialIntegrity`. To use it, keep using the old `referentialIntegrity` Preview feature flag: ```prisma generator js { provider = "prisma-client-js" previewFeatures = ["referentialIntegrity"] } ``` But use the new property name in the `datasource`: ```prisma datasource db { provider = "mysql" url = env("DATABASE_URL") relationMode = "prisma" } ``` We also removed the referential action `NoAction` for PostgreSQL and SQLite when using `relationMode = "prisma"` as we are not planning to support the details of the database behavior. To learn more about `relationMode`, please check out the [documentation](https://prisma.io/docs/concepts/components/prisma-schema/relations/referential-integrity#how-to-set-the-relation-mode-in-your-prisma-schema) or leave a comment on the [GitHub issue](https://github.com/prisma/prisma/issues/9380). ### Deno for Prisma Client for Data Proxy (Preview) [Deno](https://deno.land/) is an alternative JavaScript runtime that can replace Node.js to run JS and TS apps. It aligns itself closely with web technologies, claims to be secure by default, and supports TypeScript out of the box. Today we are releasing initial support for Prisma with Deno via an integration for our Prisma Client for Data Proxy. This feature was developed together with the amazing team at Deno 🦕. To use Prisma Client in a Deno project, add the `deno` Preview feature flag to your Prisma schema and define a folder as `output` (this is required for Deno): ```prisma generator client { provider = "prisma-client-js" previewFeatures = ["deno"] output = "../generated/client" } ``` Now you can generate Prisma Client with the Data Proxy using the command `npx prisma generate --data-proxy`. Then use Prisma Client in your Deno script with the following import: ```ts import { PrismaClient } from './generated/client/deno/edge.ts' const prisma = new PrismaClient() async function main() { const users = await prisma.user.findMany() console.log({ users }) } main() ``` You can also deploy an app built and configured like this on [Deno Deploy](https://deno.com/deploy), Deno’s deployment platform. Read [this guide in our documentation for a full example and individual steps](https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-deno-deploy). For feedback, please comment on this [GitHub issue](https://github.com/prisma/prisma/issues/15844). ### Fixed “Invalid string length” error in Prisma Studio and Prisma Data Platform Data Browser Many people were having issues with an ["Invalid string length" error](https://github.com/prisma/studio/issues?q=label%3A%22topic%3A+Invalid+string+length%22+) both in Prisma Studio and Prisma Data Platform Data Browser. This issue can be resolved through [this workaround](https://github.com/prisma/studio/issues/895#issuecomment-1083051249). With this release, the root cause of this issue has been fixed and it should not occur again. ## Updated proposal for Client Extensions: request for comments In `4.3.0`, we shared a proposal for [Prisma Client Extensions](https://github.com/prisma/prisma/issues/15074) on Github. We received a lot of great feedback, which we have incorporated into a [new proposal](https://github.com/prisma/prisma/issues/15074#issuecomment-1282419200). If you’re interested, please head over to the [new proposal](https://github.com/prisma/prisma/issues/15074#issuecomment-1282419200) in GitHub and tell us what you think. Thank you! ## Fixes and improvements ### Prisma - [Optimistic Concurrency Control](https://github.com/prisma/prisma/issues/4988) - [MySQL does not support `onDelete: setDefault`](https://github.com/prisma/prisma/issues/11498) - [Reformat unreachable code: Encountered impossible declaration during formatting](https://github.com/prisma/prisma/issues/15151) - [Switching between `referentialIntegrity` modes makes migration history obsolete](https://github.com/prisma/prisma/issues/15225) - [Rename the feature to “Prisma relation mode” → relationMode](https://github.com/prisma/prisma/issues/15601) - [[multiSchema] check PSL validations for enum and composite type database name clashes](https://github.com/prisma/prisma/issues/15626) - [Support PostgreSQL Extensions in the Prisma Schema Language](https://github.com/prisma/prisma/issues/15627) - [Support PostgreSQL Extensions in the PostgreSQL Introspection](https://github.com/prisma/prisma/issues/15628) - [Support PostgreSQL Extensions in the Migration Engine](https://github.com/prisma/prisma/issues/15629) - [Add TS test for datasource property `referentialIntegrity` and `relationMode`](https://github.com/prisma/prisma/issues/15736) - [relationMode: Change test naming](https://github.com/prisma/prisma/issues/15765) ### Prisma Client - [Be able to update or retrieve a single record including non-unique fields in the "where" conditions.](https://github.com/prisma/prisma/issues/7290) - [Remove WhereUnique constraint from single object lookups](https://github.com/prisma/prisma/issues/10376) - [Expand tests around referential actions and referential integrity](https://github.com/prisma/prisma/issues/10806) - [Feature: Allow non-unique fields to be used with update](https://github.com/prisma/prisma/issues/12268) - [QueryRaw: Error serializing parameter](https://github.com/prisma/prisma/issues/13158) - [PrismaClientUnknownRequestError on create statement default optional value](https://github.com/prisma/prisma/issues/15581) - [Problems with SQL Server deadlocks](https://github.com/prisma/prisma/issues/15607) ### Prisma Migrate - [`postgresqlExtensions`: `migrate dev` errors with `ERROR: type "citext" does not exist` when setting `extensions = [citext]`](https://github.com/prisma/prisma/issues/15803) ### Language tools (e.g. VS Code) - [Custom icon for .prisma files](https://github.com/prisma/language-tools/issues/5) - [Add autocompletion for property of `relationMode` (previously `referentialIntegrity`) in the datasource block](https://github.com/prisma/language-tools/issues/991) ## Credits Huge thanks to @kt3k, @abenhamdine, @jsoref for helping!