prisma/prisma
### [`v4.8.1`](https://togithub.com/prisma/prisma/releases/tag/4.8.1)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.8.0...4.8.1)
Today, we are issuing the `4.8.1` patch release.
#### Fixe in Prisma Client
- [Prisma 4.8 produces conflicting typescript types for custom many to many relations](https://togithub.com/prisma/prisma/issues/17005)
### [`v4.8.0`](https://togithub.com/prisma/prisma/releases/tag/4.8.0)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.7.1...4.8.0)
🌟 **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.8.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.8.0) about the release.** 🌟
##### Highlights
##### Improved serverless experience — smaller engines size
In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions.
Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when executing the first query if you're working with a bigger schema with many models and relations.
We will continue investing in this direction in the next releases and further improve the experience with Prisma and serverless environments.
##### Multi-schema support for CockroachDB (Preview)
We're pleased to share that this release adds [Preview support](https://www.prisma.io/docs/about/prisma/releases#preview) for multi-schema for CockroachDB. 🎉
This release adds support for:
- Introspecting databases that organize objects in multiple database schemas
- Managing multi-schema database setups directly from Prisma schema
- Generating migrations that are database schema-aware with Prisma Migrate
- Querying across multiple database schemas with Prisma Client
If you already have a CockroachDB database using multiple schemas, you can quickly get up and running set up multiple schemas by:
- Enabling the Preview feature in the Prisma schema
- Defining the schemas in the `schemas` property in the `datasource` block
- Introspecting your database using `prisma db pull`
You can further evolve your database schema using the multi-schema Preview feature by using `prisma migrate dev`.
For further details, refer to our [documentation](https://prisma.io/docs/guides/database/multi-schema) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/15077).
##### Improved OpenSSL 3.x support
Prisma now supports OpenSSL 3 builds for Linux Alpine on `x86_64` architectures. This particularly impacts users running Prisma on `node:alpine` and `node:lts-alpine` Docker images. The images are based on an Alpine version that ships with OpenSSL 3.0.x, which isn’t compatible with OpenSSL 1.1.x (already supported by Prisma). You can read more details about it in this GitHub [comment](https://togithub.com/prisma/prisma/issues/16553#issuecomment-1353302617).
We also have rewritten our OpenSSL version detection logic, making it future-proof. We now expect Prisma to support systems running with any OpenSSL 3 minor versions out of the box.
##### Fixes and improvements
##### Prisma
- [Migrate: @dbgenerated with @db.Time(0) keeps generating new migrations](https://togithub.com/prisma/prisma/issues/6382)
- [Error parsing attribute "@@index": The Gin index field type `Uuid` has no default operator class.](https://togithub.com/prisma/prisma/issues/14587)
- [UTF-8 Error: index is not a char boundary](https://togithub.com/prisma/prisma/issues/14895)
- [Error in migration engine. Reason: entered unreachable code ](https://togithub.com/prisma/prisma/issues/16340)
- [Regression in enum default value handling in 4.7.0](https://togithub.com/prisma/prisma/issues/16546)
- [Regression in relation field name deduplication](https://togithub.com/prisma/prisma/issues/16547)
- [multiSchema: `migrate reset` only resets first schema](https://togithub.com/prisma/prisma/issues/16561)
- [Cross schema reference with foreign key not working in 4.7.0. ](https://togithub.com/prisma/prisma/issues/16585)
- [Support SQL Server in `multiSchema` introspection](https://togithub.com/prisma/prisma/issues/16627)
- [`migrate dev` does not detect drift between database schema and migration history for `multiSchema`](https://togithub.com/prisma/prisma/issues/16634)
- [Bad credentials when downloading using @prisma/fetch-engines](https://togithub.com/prisma/prisma/issues/16685)
- [multiSchema: migrate dev fails to apply cleanly to shadow database after custom migration renames table in secondary schema](https://togithub.com/prisma/prisma/issues/16794)
##### Prisma Migrate
- [Prisma db migration always altering my table contains mysql TIME data type inside of it](https://togithub.com/prisma/prisma/issues/9769)
- [Prisma migration fails with postgres](https://togithub.com/prisma/prisma/issues/15826)
- [Migrate Dev CMD Issue when using `multiSchema` preview feature with MySQL](https://togithub.com/prisma/prisma/issues/16274)
##### Prisma Client
- [Prisma 4.3.1 distribution is bundling a libquery_engine](https://togithub.com/prisma/prisma/issues/15244)
- [enum fields are missing in select's type when `clientExtensions` preview feature is used](https://togithub.com/prisma/prisma/issues/16535)
- [`$extends` TS error: "Inferred type of this node exceeds the maximum length the compiler will serialize" with `"declaration": true` in `tsconfig`](https://togithub.com/prisma/prisma/issues/16536)
- [Regression bug: batched findUniqueOrThrow queries throw 'Field does not exist on enclosing type.'](https://togithub.com/prisma/prisma/issues/16548)
- [Prisma Client Extensions: `args` is `undefined`](https://togithub.com/prisma/prisma/issues/16551)
- [Support OpenSSL 3.0 for Alpine Linux](https://togithub.com/prisma/prisma/issues/16553)
- [`console.log` outputs incorrect value when `result` extensions are used](https://togithub.com/prisma/prisma/issues/16554)
- [4.6.0 and newer does not let me spy using vitest.](https://togithub.com/prisma/prisma/issues/16584)
- [Investigate memory issues on Windows](https://togithub.com/prisma/prisma/issues/16594)
- [prisma@4.7.1 - "RangeError: Maximum call stack size exceeded" when clientExtensions enabled](https://togithub.com/prisma/prisma/issues/16600)
- [Unique constraint error when connecting an item in a 1-1 relation that is already connected](https://togithub.com/prisma/prisma/issues/16743)
- [Error when using "multiSchema" with custom database schema and implicit Many To Many relation](https://togithub.com/prisma/prisma/issues/16761)
- [binaries.prisma.sh not accessible via IPv6](https://togithub.com/prisma/prisma/issues/16777)
- [Nested disconnect fails with `extendedWhereUnique` on SQL](https://togithub.com/prisma/prisma/issues/16843)
##### Language tools (e.g. VS Code)
- [Auto completion suggests `@map` although already present](https://togithub.com/prisma/language-tools/issues/1079)
- [Update message for detecting both Stable and Insiders in workspace](https://togithub.com/prisma/language-tools/issues/1315)
- [Update to use correct form of criteri(a/on)](https://togithub.com/prisma/language-tools/issues/1321)
- [Extra `'` in optional arguments context](https://togithub.com/prisma/language-tools/issues/1337)
##### Prisma Engines
- [Use correct forms of "criterion" (singular) and "criteria" (plural)](https://togithub.com/prisma/prisma-engines/issues/3126)
- [Only use buildjet action runner where needed](https://togithub.com/prisma/prisma-engines/issues/3370)
- [Bug: `@@schema` attribute should always be required when `schemas` is defined in the datasource](https://togithub.com/prisma/prisma-engines/issues/3502)
##### Credits
Huge thanks to [@ivan](https://togithub.com/ivan), [@Mini256](https://togithub.com/Mini256), [@cmd-johnson](https://togithub.com/cmd-johnson) for helping!
##### Prisma Help Center (New)
We recently just launched our [Help Center](https://www.prisma.io/support) that you can use to find resources and get help from our support team for both the Prisma ORM and the Prisma Data Platform.
Check it out, and let us know what you think.
##### đź“ş Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://youtu.be/-0kwU2y0SCA) live stream.
The stream takes place [on YouTube](https://youtu.be/-0kwU2y0SCA) on **Thursday, December 22** at **5 pm Berlin | 8 am San Francisco**.
### [`v4.7.1`](https://togithub.com/prisma/prisma/releases/tag/4.7.1)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.7.0...4.7.1)
Today, we are issuing the `4.7.1` patch release.
##### Fixes in Prisma Client
- [Enum fields are missing in select's type when `clientExtensions` preview feature is used](https://togithub.com/prisma/prisma/issues/16535)
- [`console.log` outputs incorrect value when `result` extensions are used](https://togithub.com/prisma/prisma/issues/16554)
- ["Field does not exist on enclosing type" error is thrown in `findUniqueOrThrow`](https://togithub.com/prisma/prisma/issues/16548)
- [Prisma Client Extensions: `args` is `undefined`](https://togithub.com/prisma/prisma/issues/16551)
### [`v4.7.0`](https://togithub.com/prisma/prisma/releases/tag/4.7.0)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.6.1...4.7.0)
🌟 **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.7.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.7.0) about the release.** 🌟
#### Highlights
##### Interactive transactions are now Generally Available
After an extensive Preview phase and lots of great feedback from our community, we're excited to announce that `interactiveTransactions` is now [Generally Available](https://www.prisma.io/docs/about/prisma/releases#generally-available-ga) and production ready! 🚀
[Interactive transactions](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions) allow you to pass an async function into a `$transaction`, and execute any code you like between the individual Prisma Client queries. Once the application reaches the end of the function, the transaction is committed to the database. If your application encounters an error as the transaction is being executed, the function will throw an exception and automatically rollback the transaction.
Here are some of the feature highlights we've built:
- Support for defining [transaction isolation levels](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#transaction-isolation-level) — from [`4.2.0`](https://togithub.com/prisma/prisma/releases/tag/4.2.0)
- Support for the Prisma Data Proxy — from [`4.6.0`](https://togithub.com/prisma/prisma/releases/tag/4.6.0)
Here's an example of an interactive transaction with a `Serializable` isolation level:
```ts
await prisma.$transaction(
async (prisma) => {
// Your transaction...
},
{
isolationLevel: Prisma.TransactionIsolationLevel.Serializable,
maxWait: 5000,
timeout: 10000,
}
)
```
You can now remove the `interactiveTransactions` Preview feature in your schema.
##### Relation mode is Generally Available
This release marks `relationMode="prisma"` as stable for our users working with databases that don't rely on foreign keys to manage relations. 🎉
Prisma’s [relation mode](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) started as a way to support PlanetScale which does not allow you to create foreign keys for better online migration support. We transformed that into our *Referential Integrity Emulation* in [`3.1.1`](https://togithub.com/prisma/prisma/releases/tag/3.1.1) when we realised that more users could benefit from it, and then integrated it as the default mode for MongoDB, which generally does not *have* foreign keys. Prisma needed to use emulation to give the same guarantees.
We then realized the feature was more than just referential integrity and affected how relations work. To reflect this, we renamed the feature to relation mode and the `datasource` property to `relationMode` in [`4.5.0`](https://togithub.com/prisma/prisma/releases/tag/4.5.0)
##### Index warnings for `relationMode = "prisma"`
In this release, we've added a warning to our Prisma schema validation that informs you that the lack of foreign keys might result in slower performance — and that you should add an `@@index` manually to your schema to counter that. This ensures your queries are equally fast in relation mode `prisma` as they are with foreign keys.
> With `relationMode = "prisma"`, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to slower performance when querying these fields. We recommend manually adding an index.
We also added a fix to our [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) to help adding the suggested index with minimal effort:
![](https://user-images.githubusercontent.com/33921841/204537961-fb1049d3-ca33-4055-8e8e-0f6448e09695.png)
If you are currently using the Preview feature flag to enable relation mode, you can now remove `referentialIntegrity` from the `previewFeatures` in your `generator client` block in your Prisma schema.
For more information, check out our [updated relation mode documentation](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode).
##### Prisma Client Extensions (Preview)
This release adds Preview support for Prisma Client Extensions. This feature introduces new capabilities to customize and extend Prisma Client. Today we are opening up four areas for extending Prisma Client:
- `model`: add [custom methods or fields](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/model) to your models
- `client`: add [client-level methods to Prisma Client](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/client)
- `result`: add [custom fields to your query results](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/result)
- `query`: create [custom Prisma Client queries](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/query)
Prisma Client Extensions are self-contained scripts that can tweak the behavior of models, queries, results, and the client (Prisma Client) as a whole. You can associate a single or multiple extensions with an extended client to mix and match Prisma to your needs.
Prisma Client Extensions enables many use cases such as defining virtual fields, custom validation, and custom queries.
It also enables you to [share your client extensions](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/shared-extensions) with others and [import client extensions developed by others](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions/shared-extensions#install-a-packaged-extension) into your project.
For example, given the following schema:
```prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["clientExtensions"]
}
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String?
lastName String
}
```
You can create a computed field called `fullName` as follows:
```ts
import { PrismaClient } from "@prisma/client"
const prisma = new PrismaClient()
.$extends({
result: {
user: {
fullName: {
// the dependencies
needs: { firstName: true, lastName: true },
compute(user) {
// the computation logic
return `${user.firstName} ${user.lastName}`
},
},
},
},
})
```
We're excited to see what you build with them! For more information, check out our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/16500).
##### Multi-schema support for PostgreSQL (Preview)
We're pleased to announce that this release adds support for multi-schema support for PostgreSQL. The ability to query and manage multiple database schemas has been a long-standing feature request from our community.
This release adds support for the following:
- Introspecting databases that organize objects in multiple database schemas
- Managing multi-schema database setups directly from Prisma schema
- Generating migrations that are database schema-aware with Prisma Migrate
- Querying across multiple database schemas with Prisma Client
If you already have a PostgreSQL database using multiple schemas, you can quickly get up and running using `prisma db pull` — on enabling the Preview feature and specifying the schemas in the `datasource` block similar to the example below.
You can get started with defining multiple schemas in your Prisma schema as follows:
```prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["base", "transactional"]
}
model User {
id Int @id
orders Order[]
@@schema("base")
}
model Order {
id Int @id
user User @relation(fields: [id], references: [id])
user_id Int
@@schema("transactional")
}
```
Then generate and apply the changes to your database with `prisma migrate dev`.
We want to thank all our users for helping us design the feature since the early proposal on GitHub up to our current Preview release.
For further details, refer to our [documentation](https://prisma.io/docs/guides/database/multi-schema) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/15077).
#### Request for feedback
Our Product team is currently running a [survey](https://prisma103696.typeform.com/views-support) for designing [Database Views support](https://togithub.com/prisma/prisma/issues/678#issuecomment-1330304851) for Prisma and we would appreciate your feedback.
#### Fixes and improvements
##### Prisma Client
- [`RangeError: Invalid count value` during `npx prisma generate` with `DEBUG=*` on integration build](https://togithub.com/prisma/prisma/issues/9429)
- [When rejectOnNotFound is used, chaining deeper into a related table still throws if it doesn't find anything](https://togithub.com/prisma/prisma/issues/10642)
- [Stabilize `referentialIntegrity`](https://togithub.com/prisma/prisma/issues/10807)
- [Some errors are obfuscated by interactive transactions when using `binary` engine](https://togithub.com/prisma/prisma/issues/12862)
- [Transaction API error: Transaction already closed: Transaction is no longer valid. Last state: 'Expired' P2028](https://togithub.com/prisma/prisma/issues/13713)
- [The error is incorrectly pointed out when using the $transaction method](https://togithub.com/prisma/prisma/issues/14373)
- [Client: using update + connect throws an error on an idempotent operation](https://togithub.com/prisma/prisma/issues/14759)
- [findFirstOrThrow / findUniqueOrThrow errors are not reported via `error` event](https://togithub.com/prisma/prisma/issues/14933)
- [wrong error message/header on multiple table upsert using transaction](https://togithub.com/prisma/prisma/issues/15433)
- [Args are out of sync with the action type for count when creating prisma middeware](https://togithub.com/prisma/prisma/issues/15644)
- [“Transaction API error: Transaction not found”](https://togithub.com/prisma/prisma/issues/16050)
- [Add `Prisma.TransactionClient` to `default-index.d.ts`](https://togithub.com/prisma/prisma/issues/16103)
- [RangeError: Invalid count value during prisma generate](https://togithub.com/prisma/prisma/issues/16126)
- [Prisma Client regression bug after upgrading to 4.6.0: `findMany` errors with `PANIC: index out of bounds: the len is 0 but the index is 0`](https://togithub.com/prisma/prisma/issues/16195)
- [`upsert()` with nested selection errors with ` called `Option::unwrap()`on a`None` value ` in 4.6.0](https://togithub.com/prisma/prisma/issues/16196)
- [Bug(qe): errors don't get logged](https://togithub.com/prisma/prisma/issues/16226)
- [Downloading binaries of 4.6.1 fails with wrong sha256 checksum](https://togithub.com/prisma/prisma/issues/16233)
- [Calling `findUnique` concurrently with different key order causes one of them to return null](https://togithub.com/prisma/prisma/issues/16267)
- [No way to catch error in `findUniqueOrThrow` via middleware](https://togithub.com/prisma/prisma/issues/16354)
- [Test implicit m:n in relation mode `prisma` / Reproduction test for prisma#16390](https://togithub.com/prisma/prisma/issues/16423)
##### Prisma
- [\[Multi Schema\] Same model map different schema](https://togithub.com/prisma/prisma/issues/15009)
- [Schema: add deprecation warning for datasource property `referentialIntegrity` (renamed to `relationMode`)](https://togithub.com/prisma/prisma/issues/15689)
- [Error in migration engine. Reason: \[migration-engine/connectors/sql-migration-connector/src/sql_renderer/postgres_renderer.rs:944:22\] We should only be setting a changed default if there was one on the previous schema and in the next with the same enum. ](https://togithub.com/prisma/prisma/issues/15705)
- [`db pull` with `multiSchema` error on schema with 2 models with the same table name but in a different schema](https://togithub.com/prisma/prisma/issues/15800)
- [Prisma 4.6.0 drops and recreates enum field when running db push even if the field has not changed](https://togithub.com/prisma/prisma/issues/16180)
- [@@map not working on postgress enums starting version 4.6.0](https://togithub.com/prisma/prisma/issues/16209)
- [`relationMode`: make feature GA](https://togithub.com/prisma/prisma/issues/16224)
- [Add `SetDefault` validation error with warnings when `provider = "mysql"` and `relationMode = "foreignKeys" | default`](https://togithub.com/prisma/prisma/issues/16259)
- [Polish `relationMode` validation warning messages ](https://togithub.com/prisma/prisma/issues/16440)
- [Add linting/validation warnings for `prisma validate` & `prisma format`](https://togithub.com/prisma/prisma/issues/16441)
##### Prisma Migrate
- [What happen with `prisma migrate dev` ](https://togithub.com/prisma/prisma/issues/16220)
- [Prisma complains when enum types are not declared in alphabetical order](https://togithub.com/prisma/prisma/issues/16225)
##### Language tools (e.g. VS Code)
- [Dim models that are `@@ignore`d and fields that are `@ignore`d](https://togithub.com/prisma/language-tools/issues/689)
- [Recommend adding indices to foreign keys when `referentialIntegrity = "prisma"`](https://togithub.com/prisma/language-tools/issues/992)
- [PostgreSQL only: Add autocompletion in the datasource block for `extensions` when `postgresqlExtensions` preview feature is set](https://togithub.com/prisma/language-tools/issues/1265)
- [language-tools: `relationMode` GA - remove preview feature condition](https://togithub.com/prisma/language-tools/issues/1282)
- [feat: for `relationMode="prisma"`, for `@relation`: add a warning if there is no index on the field(s)](https://togithub.com/prisma/language-tools/issues/1296)
- [feat: Quick Fix - `relationMode` : missing foreign keys' indexes](https://togithub.com/prisma/language-tools/issues/1297)
##### Prisma Engines
- [bug(fmt): quick-fixes break with no newline after model in schema](https://togithub.com/prisma/prisma-engines/issues/3444)
#### Credits
Huge thanks to [@cmd-johnson](https://togithub.com/cmd-johnson), [@jsoref](https://togithub.com/jsoref), [@miguelgargallo](https://togithub.com/miguelgargallo) for helping!
#### Prisma Data Platform
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the following:
- **Data Browser** for navigating, editing, and querying data
- **Data Proxy** for your database's persistent, reliable, and scalable connection pooling.
- **Query Console** for experimenting with queries
[Try it out](https://cloud.prisma.io/). Let us know what you think!
#### đź“ş Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://youtu.be/oWjqeU7fowE) live stream.
The stream takes place [on YouTube](https://youtu.be/oWjqeU7fowE) on **Thursday, December 1** at **5 pm Berlin | 8 am San Francisco**.
### [`v4.6.1`](https://togithub.com/prisma/prisma/releases/tag/4.6.1)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.6.0...4.6.1)
Today, we are issuing the `4.6.1` patch release.
#### Fixes in Prisma Client
- [Prisma Client regression bug after upgrading to 4.6.0: `findMany` errors with `PANIC: index out of bounds: the len is 0 but the index is 0`](https://togithub.com/prisma/prisma/issues/16195)
- [`upsert()` with nested selection errors with ` called `Option::unwrap()`on a`None` value ` in 4.6.0](https://togithub.com/prisma/prisma/issues/16196)
#### Fix in Prisma Migrate
- [Prisma 4.6.0 drops and recreates enum field when running db push even if the field has not changed](https://togithub.com/prisma/prisma/issues/16180)
### [`v4.6.0`](https://togithub.com/prisma/prisma/releases/tag/4.6.0)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.5.0...4.6.0)
🌟 **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.6.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.6.0) about the release.** 🌟
#### Highlights
##### Interactive Transactions for Prisma Data Proxy (Preview)
In [3.8.0](https://togithub.com/prisma/prisma/releases/tag/3.8.0), we disabled the `interactiveTransactions` [Preview feature](https://www.prisma.io/docs/about/prisma/releases#preview) when using the Prisma Data Proxy. This was because the API was not yet supported.
In this release, we're removing the limitation. You can now try the Preview version of [interactive transactions](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions-in-preview) with the Prisma Data Proxy. Re-generate Prisma Client using `prisma generate --data-proxy` after enabling the Preview feature.
**Note**: The `interactiveTransactions` Preview feature flag is still needed. We will remove this in a future version when the feature is stable.
Try it out and let us know your thoughts in our [interactive transactions feedback GitHub issue](https://togithub.com/prisma/prisma/issues/8664).
##### Native database level upserts for PostgreSQL, SQLite, and CockroachDB
Prisma’s upsert is one of its most powerful and most convenient APIs. In this release, Prisma will now default to the native database upsert for PostgreSQL, SQLite, and CockroachDB whenever possible.
Prisma will use the native database upsert if:
- There are no nested queries in the `upsert`'s `create` and `update` [options](https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#upsert-1)
- The query modifies only one model
- There is only one unique field in the `upsert`'s `where` option
- The unique field in the `where` option and the unique field in the `create` option have the same value
Prisma Client's [`upsert`](https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#upsert) operation was implemented on a Prisma-level and did not use the native database implementations like, e.g., `INSERT .. ON CONFLICT .. UPDATE SET`. This allowed Prisma to also upsert nested queries.
The Prisma-implementation came at a cost. In some scenarios, it was more likely for a transaction to roll back because of a conflict when multiple `upsert` operations were being executed in parallel, and the multiple queries often took longer than the native database query would have taken.
Try it out and let us know what you think. If you run into any issues, don't hesitate to create a [GitHub issue](https://togithub.com/prisma/prisma/issues/new?assignees=\&labels=kind%2Fbug\&template=bug_report.yml).
##### Relation Mode improvements (Preview)
In [4.5.0](https://togithub.com/prisma/prisma/releases/tag/4.5.0), we renamed the "Referential Integrity" Preview feature to "Relation Mode". We also changed the `datasource` property name of the feature to `relationMode`.
In this release, we fixed all remaining known bugs of `relationMode = "prisma"` and cleaned up our documentation. You can now read about [Relation mode](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) on its [own documentation page](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) which is up to date with the implementation.
If you encounter any problems [please comment on our feedback issue](https://togithub.com/prisma/prisma/issues/9380). We plan to make this [Generally Available](https://www.prisma.io/docs/about/prisma/releases#generally-available-ga) soon.
##### `extendedWhereUnique` improvements (Preview)
In [4.5.0](https://togithub.com/prisma/prisma/releases/tag/4.5.0), we introduced the `extendedWhereUnique` Preview feature to allow filtering for non-unique properties in unique where queries. In this release, we're adding new rules to decide when concurrent `findUnique` queries get batched into a `findMany` query.
Unfortunately, we forgot to adapt our `findUnique` [query batch optimization](https://www.prisma.io/docs/guides/performance-and-optimization/query-optimization-performance#solving-the-n1-problem), which turns multiple concurrent `findUnique` queries into a single `findMany` query when possible — [GitHub issue](https://togithub.com/prisma/prisma/issues/15934).
Therefore, `findUnique` queries will get batched into a `findMany` query if:
- All criteria of the filter must be on scalar fields (unique ***or*** non-unique) of the same model you're querying
- All criteria must use the equal's filter, whether that's via the shorthand or explicit syntax (`where: { field: , field1: { equals: } }`)
Conversely, suppose the filter object contains any boolean operators, relation filters, or scalar filters that are ****not**** using `equals`. Prisma will fall back to executing the `findUnique` queries independently.
Let us know your thoughts and share your feedback on the Preview feature in this [GitHub issue](https://togithub.com/prisma/prisma/issues/15837).
#### Fixes and improvements
##### Prisma Client
- [upsert across HTTP requests has a race condition](https://togithub.com/prisma/prisma/issues/3242)
- [Client tests for Vitess, with `relationMode=prisma`](https://togithub.com/prisma/prisma/issues/6927)
- [Concurrent relation upserts conflict](https://togithub.com/prisma/prisma/issues/9751)
- [`upsert()` should do ON CONFLICT DO UPDATE/NOTHING in postgresql](https://togithub.com/prisma/prisma/issues/9972)
- [Cannot insert Floats (≥9.223372037e18 and <1e21) or (>-1e21 and ≤-9.223372037e18)](https://togithub.com/prisma/prisma/issues/12651)
- [Always serialize float fields in exponent notation](https://togithub.com/prisma/prisma/issues/13317)
- [Postgres integer column silently overflows to bad value](https://togithub.com/prisma/prisma/issues/13913)
- [Add duration to mongo logging](https://togithub.com/prisma/prisma/issues/14378)
- [upsert(): Unique constraint on DateTime sqlite](https://togithub.com/prisma/prisma/issues/14584)
- ["Unique constraint failed on the fields" when using upsert](https://togithub.com/prisma/prisma/issues/14868)
- [using connect in interactive transaction fails](https://togithub.com/prisma/prisma/issues/15044)
- [MongoDB does not log queries with `binary` Engine](https://togithub.com/prisma/prisma/issues/15084)
- [\[MongoDb\] Query logger produces incorrect output](https://togithub.com/prisma/prisma/issues/15467)
- [Float values around 2^63 get interpreted as invalid intergers and throw a graphql error](https://togithub.com/prisma/prisma/issues/15551)
- [referentialIntegrity/relationMode preview feature (`referentialIntegrity = "prisma"`): Make `NoAction` a synonym/alias of `Restrict` for the emulation, for all databases except PostgreSQL & SQLite.](https://togithub.com/prisma/prisma/issues/15655)
- [Client: In 1:1,1:n, m:n relations using `OnDelete: SetNull` with `referentialIntegrity = "prisma"` `user.delete()` should fail, but succeeds.](https://togithub.com/prisma/prisma/issues/15683)
- [calling findUnique concurrently on a model with a compound unique constraint causes it to return null](https://togithub.com/prisma/prisma/issues/15934)
- [Support interactive transactions in the Data Proxy](https://togithub.com/prisma/prisma/issues/16177)
##### Prisma
- [Re-Introspection: `referentialIntegrity = prisma` not respected when using `@@map()`](https://togithub.com/prisma/prisma/issues/11022)
- [Validation fails to detect invalid `SetNull` referential action referencing non-optional fields](https://togithub.com/prisma/prisma/issues/14673)
- [Schema: add validation for datasource property referentialIntegrity & relationMode, so only one can be set.](https://togithub.com/prisma/prisma/issues/15735)
- [Create TypeScript tests for #15655](https://togithub.com/prisma/prisma/issues/15882)
- [`referentialIntegrity` policy is lost during re-introspection](https://togithub.com/prisma/prisma/issues/16007)
- [Relation fields are removed after npx prisma db pull](https://togithub.com/prisma/prisma/issues/16100)
- [Re-introspection should not remove relations when relationMode="prisma"](https://togithub.com/prisma/prisma/issues/16130)
##### Language tools (e.g. VS Code)
- [Schema autocompletion intellisense don't match custom datasource name](https://togithub.com/prisma/language-tools/issues/1223)
#### Design Partner Program
Are you building data-intensive applications in serverless environments using Prisma? If so, you should join our Design Partner Program to help us build the tools that best fit your workflows!
The Design Partner Program aims to help development teams solve operational, data-related challenges in serverless environments. Specifically, we’re looking to build tools that help with the following problems:
- Solutions to **listen and react to database changes in real time** are either brittle or too complex to build and operate.
- **Coordinating workflows executed via a set of isolated functions or services** spreads that coordination logic across these services instead of keeping it centralized and maintainable. This adds unnecessary overhead and clutter to your business logic.
- **Optimizing the data access layer for scaling performance** often involves projecting data into denormalized views, or caching. These methods come with complex logic to figure out strategies for cache invalidation or preventing to use stale data.
- **Building web applications on modern Serverless platforms such as Vercel or Netlify often breaks down** as soon as you need to execute on any of the topics listed above. This pushes to re-platform on a traditional infrastructure, delaying projects, and losing productivity benefits offered by Vercel or Netlify.
[**Submit an application**](https://docs.google.com/forms/d/e/1FAIpQLSdfadMO7qVOMlOgmeYevpM-olpjku2-3sVzMvVQiHITmZf4dA/viewform) through our application form to join the Prisma Design Partner Program to take advantage of new features that you won't have to build or maintain yourselves.
#### Prisma Data Platform
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the following:
- **Data Browser** for navigating, editing, and querying data
- **Data Proxy** for your database's persistent, reliable, and scalable connection pooling.
- **Query Console** for experimenting with queries
[Try it out](https://cloud.prisma.io/). Let us know what you think!
#### đź“ş Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://youtu.be/o_e_KCqXaRo) live stream.
The stream takes place [on YouTube](https://youtu.be/o_e_KCqXaRo) on **Thursday, November 10** at **5 pm Berlin | 8 am San Francisco**.
##### Credits
Huge thanks to [@cmd-johnson](https://togithub.com/cmd-johnson) for helping!
### [`v4.5.0`](https://togithub.com/prisma/prisma/releases/tag/4.5.0)
[Compare Source](https://togithub.com/prisma/prisma/compare/4.4.0...4.5.0)
🌟 **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://togithub.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://togithub.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://togithub.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://togithub.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://togithub.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://togithub.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://togithub.com/prisma/prisma/issues/15074) on Github. We received a lot of great feedback, which we have incorporated into a [new proposal](https://togithub.com/prisma/prisma/issues/15074#issuecomment-1282419200).
If you’re interested, please head over to the [new proposal](https://togithub.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://togithub.com/prisma/prisma/issues/4988)
- [MySQL does not support `onDelete: setDefault`](https://togithub.com/prisma/prisma/issues/11498)
- [Reformat unreachable code: Encountered impossible declaration during formatting](https://togithub.com/prisma/prisma/issues/15151)
- [Switching between `referentialIntegrity` modes makes migration history obsolete](https://togithub.com/prisma/prisma/issues/15225)
- [Rename the feature to “Prisma relation mode” → relationMode](https://togithub.com/prisma/prisma/issues/15601)
- [\[multiSchema\] check PSL validations for enum and composite type database name clashes](https://togithub.com/prisma/prisma/issues/15626)
- [Support PostgreSQL Extensions in the Prisma Schema Language](https://togithub.com/prisma/prisma/issues/15627)
- [Support PostgreSQL Extensions in the PostgreSQL Introspection](https://togithub.com/prisma/prisma/issues/15628)
- [Support PostgreSQL Extensions in the Migration Engine](https://togithub.com/prisma/prisma/issues/15629)
- [Add TS test for datasource property `referentialIntegrity` and `relationMode`](https://togithub.com/prisma/prisma/issues/15736)
- [relationMode: Change test naming](https://togithub.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://togithub.com/prisma/prisma/issues/7290)
- [Remove WhereUnique constraint from single object lookups](https://togithub.com/prisma/prisma/issues/10376)
- [Expand tests around referential actions and referential integrity](https://togithub.com/prisma/prisma/issues/10806)
- [Feature: Allow non-unique fields to be used with update](https://togithub.com/prisma/prisma/issues/12268)
- [QueryRaw: Error serializing parameter](https://togithub.com/prisma/prisma/issues/13158)
- [PrismaClientUnknownRequestError on create statement default optional value](https://togithub.com/prisma/prisma/issues/15581)
- [Problems with SQL Server deadlocks](https://togithub.com/prisma/prisma/issues/15607)
##### Prisma Migrate
- [`postgresqlExtensions`: `migrate dev` errors with `ERROR: type "citext" does not exist` when setting `extensions = [citext]`](https://togithub.com/prisma/prisma/issues/15803)
##### Language tools (e.g. VS Code)
- [Custom icon for .prisma files](https://togithub.com/prisma/language-tools/issues/5)
- [Add autocompletion for property of `relationMode` (previously `referentialIntegrity`) in the datasource block](https://togithub.com/prisma/language-tools/issues/991)
##### Credits
Huge thanks to [@kt3k](https://togithub.com/kt3k), [@abenhamdine](https://togithub.com/abenhamdine), [@jsoref](https://togithub.com/jsoref) for helping!
Configuration
đź“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
4.4.0
->4.8.1
Release Notes
prisma/prisma
### [`v4.8.1`](https://togithub.com/prisma/prisma/releases/tag/4.8.1) [Compare Source](https://togithub.com/prisma/prisma/compare/4.8.0...4.8.1) Today, we are issuing the `4.8.1` patch release. #### Fixe in Prisma Client - [Prisma 4.8 produces conflicting typescript types for custom many to many relations](https://togithub.com/prisma/prisma/issues/17005) ### [`v4.8.0`](https://togithub.com/prisma/prisma/releases/tag/4.8.0) [Compare Source](https://togithub.com/prisma/prisma/compare/4.7.1...4.8.0) 🌟 **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.8.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.8.0) about the release.** 🌟 ##### Highlights ##### Improved serverless experience — smaller engines size In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions. Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when executing the first query if you're working with a bigger schema with many models and relations. We will continue investing in this direction in the next releases and further improve the experience with Prisma and serverless environments. ##### Multi-schema support for CockroachDB (Preview) We're pleased to share that this release adds [Preview support](https://www.prisma.io/docs/about/prisma/releases#preview) for multi-schema for CockroachDB. 🎉 This release adds support for: - Introspecting databases that organize objects in multiple database schemas - Managing multi-schema database setups directly from Prisma schema - Generating migrations that are database schema-aware with Prisma Migrate - Querying across multiple database schemas with Prisma Client If you already have a CockroachDB database using multiple schemas, you can quickly get up and running set up multiple schemas by: - Enabling the Preview feature in the Prisma schema - Defining the schemas in the `schemas` property in the `datasource` block - Introspecting your database using `prisma db pull` You can further evolve your database schema using the multi-schema Preview feature by using `prisma migrate dev`. For further details, refer to our [documentation](https://prisma.io/docs/guides/database/multi-schema) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/15077). ##### Improved OpenSSL 3.x support Prisma now supports OpenSSL 3 builds for Linux Alpine on `x86_64` architectures. This particularly impacts users running Prisma on `node:alpine` and `node:lts-alpine` Docker images. The images are based on an Alpine version that ships with OpenSSL 3.0.x, which isn’t compatible with OpenSSL 1.1.x (already supported by Prisma). You can read more details about it in this GitHub [comment](https://togithub.com/prisma/prisma/issues/16553#issuecomment-1353302617). We also have rewritten our OpenSSL version detection logic, making it future-proof. We now expect Prisma to support systems running with any OpenSSL 3 minor versions out of the box. ##### Fixes and improvements ##### Prisma - [Migrate: @dbgenerated with @db.Time(0) keeps generating new migrations](https://togithub.com/prisma/prisma/issues/6382) - [Error parsing attribute "@@index": The Gin index field type `Uuid` has no default operator class.](https://togithub.com/prisma/prisma/issues/14587) - [UTF-8 Error: index is not a char boundary](https://togithub.com/prisma/prisma/issues/14895) - [Error in migration engine. Reason: entered unreachable code ](https://togithub.com/prisma/prisma/issues/16340) - [Regression in enum default value handling in 4.7.0](https://togithub.com/prisma/prisma/issues/16546) - [Regression in relation field name deduplication](https://togithub.com/prisma/prisma/issues/16547) - [multiSchema: `migrate reset` only resets first schema](https://togithub.com/prisma/prisma/issues/16561) - [Cross schema reference with foreign key not working in 4.7.0. ](https://togithub.com/prisma/prisma/issues/16585) - [Support SQL Server in `multiSchema` introspection](https://togithub.com/prisma/prisma/issues/16627) - [`migrate dev` does not detect drift between database schema and migration history for `multiSchema`](https://togithub.com/prisma/prisma/issues/16634) - [Bad credentials when downloading using @prisma/fetch-engines](https://togithub.com/prisma/prisma/issues/16685) - [multiSchema: migrate dev fails to apply cleanly to shadow database after custom migration renames table in secondary schema](https://togithub.com/prisma/prisma/issues/16794) ##### Prisma Migrate - [Prisma db migration always altering my table contains mysql TIME data type inside of it](https://togithub.com/prisma/prisma/issues/9769) - [Prisma migration fails with postgres](https://togithub.com/prisma/prisma/issues/15826) - [Migrate Dev CMD Issue when using `multiSchema` preview feature with MySQL](https://togithub.com/prisma/prisma/issues/16274) ##### Prisma Client - [Prisma 4.3.1 distribution is bundling a libquery_engine](https://togithub.com/prisma/prisma/issues/15244) - [enum fields are missing in select's type when `clientExtensions` preview feature is used](https://togithub.com/prisma/prisma/issues/16535) - [`$extends` TS error: "Inferred type of this node exceeds the maximum length the compiler will serialize" with `"declaration": true` in `tsconfig`](https://togithub.com/prisma/prisma/issues/16536) - [Regression bug: batched findUniqueOrThrow queries throw 'Field does not exist on enclosing type.'](https://togithub.com/prisma/prisma/issues/16548) - [Prisma Client Extensions: `args` is `undefined`](https://togithub.com/prisma/prisma/issues/16551) - [Support OpenSSL 3.0 for Alpine Linux](https://togithub.com/prisma/prisma/issues/16553) - [`console.log` outputs incorrect value when `result` extensions are used](https://togithub.com/prisma/prisma/issues/16554) - [4.6.0 and newer does not let me spy using vitest.](https://togithub.com/prisma/prisma/issues/16584) - [Investigate memory issues on Windows](https://togithub.com/prisma/prisma/issues/16594) - [prisma@4.7.1 - "RangeError: Maximum call stack size exceeded" when clientExtensions enabled](https://togithub.com/prisma/prisma/issues/16600) - [Unique constraint error when connecting an item in a 1-1 relation that is already connected](https://togithub.com/prisma/prisma/issues/16743) - [Error when using "multiSchema" with custom database schema and implicit Many To Many relation](https://togithub.com/prisma/prisma/issues/16761) - [binaries.prisma.sh not accessible via IPv6](https://togithub.com/prisma/prisma/issues/16777) - [Nested disconnect fails with `extendedWhereUnique` on SQL](https://togithub.com/prisma/prisma/issues/16843) ##### Language tools (e.g. VS Code) - [Auto completion suggests `@map` although already present](https://togithub.com/prisma/language-tools/issues/1079) - [Update message for detecting both Stable and Insiders in workspace](https://togithub.com/prisma/language-tools/issues/1315) - [Update to use correct form of criteri(a/on)](https://togithub.com/prisma/language-tools/issues/1321) - [Extra `'` in optional arguments context](https://togithub.com/prisma/language-tools/issues/1337) ##### Prisma Engines - [Use correct forms of "criterion" (singular) and "criteria" (plural)](https://togithub.com/prisma/prisma-engines/issues/3126) - [Only use buildjet action runner where needed](https://togithub.com/prisma/prisma-engines/issues/3370) - [Bug: `@@schema` attribute should always be required when `schemas` is defined in the datasource](https://togithub.com/prisma/prisma-engines/issues/3502) ##### Credits Huge thanks to [@ivan](https://togithub.com/ivan), [@Mini256](https://togithub.com/Mini256), [@cmd-johnson](https://togithub.com/cmd-johnson) for helping! ##### Prisma Help Center (New) We recently just launched our [Help Center](https://www.prisma.io/support) that you can use to find resources and get help from our support team for both the Prisma ORM and the Prisma Data Platform. Check it out, and let us know what you think. ##### 📺 Join us for another "What's new in Prisma" live stream Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://youtu.be/-0kwU2y0SCA) live stream. The stream takes place [on YouTube](https://youtu.be/-0kwU2y0SCA) on **Thursday, December 22** at **5 pm Berlin | 8 am San Francisco**. ### [`v4.7.1`](https://togithub.com/prisma/prisma/releases/tag/4.7.1) [Compare Source](https://togithub.com/prisma/prisma/compare/4.7.0...4.7.1) Today, we are issuing the `4.7.1` patch release. ##### Fixes in Prisma Client - [Enum fields are missing in select's type when `clientExtensions` preview feature is used](https://togithub.com/prisma/prisma/issues/16535) - [`console.log` outputs incorrect value when `result` extensions are used](https://togithub.com/prisma/prisma/issues/16554) - ["Field does not exist on enclosing type" error is thrown in `findUniqueOrThrow`](https://togithub.com/prisma/prisma/issues/16548) - [Prisma Client Extensions: `args` is `undefined`](https://togithub.com/prisma/prisma/issues/16551) ### [`v4.7.0`](https://togithub.com/prisma/prisma/releases/tag/4.7.0) [Compare Source](https://togithub.com/prisma/prisma/compare/4.6.1...4.7.0) 🌟 **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.7.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.7.0) about the release.** 🌟 #### Highlights ##### Interactive transactions are now Generally Available After an extensive Preview phase and lots of great feedback from our community, we're excited to announce that `interactiveTransactions` is now [Generally Available](https://www.prisma.io/docs/about/prisma/releases#generally-available-ga) and production ready! 🚀 [Interactive transactions](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions) allow you to pass an async function into a `$transaction`, and execute any code you like between the individual Prisma Client queries. Once the application reaches the end of the function, the transaction is committed to the database. If your application encounters an error as the transaction is being executed, the function will throw an exception and automatically rollback the transaction. Here are some of the feature highlights we've built: - Support for defining [transaction isolation levels](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#transaction-isolation-level) — from [`4.2.0`](https://togithub.com/prisma/prisma/releases/tag/4.2.0) - Support for the Prisma Data Proxy — from [`4.6.0`](https://togithub.com/prisma/prisma/releases/tag/4.6.0) Here's an example of an interactive transaction with a `Serializable` isolation level: ```ts await prisma.$transaction( async (prisma) => { // Your transaction... }, { isolationLevel: Prisma.TransactionIsolationLevel.Serializable, maxWait: 5000, timeout: 10000, } ) ``` You can now remove the `interactiveTransactions` Preview feature in your schema. ##### Relation mode is Generally Available This release marks `relationMode="prisma"` as stable for our users working with databases that don't rely on foreign keys to manage relations. 🎉 Prisma’s [relation mode](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) started as a way to support PlanetScale which does not allow you to create foreign keys for better online migration support. We transformed that into our *Referential Integrity Emulation* in [`3.1.1`](https://togithub.com/prisma/prisma/releases/tag/3.1.1) when we realised that more users could benefit from it, and then integrated it as the default mode for MongoDB, which generally does not *have* foreign keys. Prisma needed to use emulation to give the same guarantees. We then realized the feature was more than just referential integrity and affected how relations work. To reflect this, we renamed the feature to relation mode and the `datasource` property to `relationMode` in [`4.5.0`](https://togithub.com/prisma/prisma/releases/tag/4.5.0) ##### Index warnings for `relationMode = "prisma"` In this release, we've added a warning to our Prisma schema validation that informs you that the lack of foreign keys might result in slower performance — and that you should add an `@@index` manually to your schema to counter that. This ensures your queries are equally fast in relation mode `prisma` as they are with foreign keys. > With `relationMode = "prisma"`, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to slower performance when querying these fields. We recommend manually adding an index. We also added a fix to our [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) to help adding the suggested index with minimal effort: ![](https://user-images.githubusercontent.com/33921841/204537961-fb1049d3-ca33-4055-8e8e-0f6448e09695.png) If you are currently using the Preview feature flag to enable relation mode, you can now remove `referentialIntegrity` from the `previewFeatures` in your `generator client` block in your Prisma schema. For more information, check out our [updated relation mode documentation](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode). ##### Prisma Client Extensions (Preview) This release adds Preview support for Prisma Client Extensions. This feature introduces new capabilities to customize and extend Prisma Client. Today we are opening up four areas for extending Prisma Client: - `model`: add [custom methods or fields](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/model) to your models - `client`: add [client-level methods to Prisma Client](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/client) - `result`: add [custom fields to your query results](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/result) - `query`: create [custom Prisma Client queries](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/query) Prisma Client Extensions are self-contained scripts that can tweak the behavior of models, queries, results, and the client (Prisma Client) as a whole. You can associate a single or multiple extensions with an extended client to mix and match Prisma to your needs. Prisma Client Extensions enables many use cases such as defining virtual fields, custom validation, and custom queries. It also enables you to [share your client extensions](https://prisma.io/docs/concepts/components/prisma-client/client-extensions/shared-extensions) with others and [import client extensions developed by others](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions/shared-extensions#install-a-packaged-extension) into your project. For example, given the following schema: ```prisma datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" previewFeatures = ["clientExtensions"] } model User { id Int @id @default(autoincrement()) email String @unique firstName String? lastName String } ``` You can create a computed field called `fullName` as follows: ```ts import { PrismaClient } from "@prisma/client" const prisma = new PrismaClient() .$extends({ result: { user: { fullName: { // the dependencies needs: { firstName: true, lastName: true }, compute(user) { // the computation logic return `${user.firstName} ${user.lastName}` }, }, }, }, }) ``` We're excited to see what you build with them! For more information, check out our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/16500). ##### Multi-schema support for PostgreSQL (Preview) We're pleased to announce that this release adds support for multi-schema support for PostgreSQL. The ability to query and manage multiple database schemas has been a long-standing feature request from our community. This release adds support for the following: - Introspecting databases that organize objects in multiple database schemas - Managing multi-schema database setups directly from Prisma schema - Generating migrations that are database schema-aware with Prisma Migrate - Querying across multiple database schemas with Prisma Client If you already have a PostgreSQL database using multiple schemas, you can quickly get up and running using `prisma db pull` — on enabling the Preview feature and specifying the schemas in the `datasource` block similar to the example below. You can get started with defining multiple schemas in your Prisma schema as follows: ```prisma generator client { provider = "prisma-client-js" previewFeatures = ["multiSchema"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") schemas = ["base", "transactional"] } model User { id Int @id orders Order[] @@schema("base") } model Order { id Int @id user User @relation(fields: [id], references: [id]) user_id Int @@schema("transactional") } ``` Then generate and apply the changes to your database with `prisma migrate dev`. We want to thank all our users for helping us design the feature since the early proposal on GitHub up to our current Preview release. For further details, refer to our [documentation](https://prisma.io/docs/guides/database/multi-schema) and let us know what you think in this [GitHub issue](https://togithub.com/prisma/prisma/issues/15077). #### Request for feedback Our Product team is currently running a [survey](https://prisma103696.typeform.com/views-support) for designing [Database Views support](https://togithub.com/prisma/prisma/issues/678#issuecomment-1330304851) for Prisma and we would appreciate your feedback. #### Fixes and improvements ##### Prisma Client - [`RangeError: Invalid count value` during `npx prisma generate` with `DEBUG=*` on integration build](https://togithub.com/prisma/prisma/issues/9429) - [When rejectOnNotFound is used, chaining deeper into a related table still throws if it doesn't find anything](https://togithub.com/prisma/prisma/issues/10642) - [Stabilize `referentialIntegrity`](https://togithub.com/prisma/prisma/issues/10807) - [Some errors are obfuscated by interactive transactions when using `binary` engine](https://togithub.com/prisma/prisma/issues/12862) - [Transaction API error: Transaction already closed: Transaction is no longer valid. Last state: 'Expired' P2028](https://togithub.com/prisma/prisma/issues/13713) - [The error is incorrectly pointed out when using the $transaction method](https://togithub.com/prisma/prisma/issues/14373) - [Client: using update + connect throws an error on an idempotent operation](https://togithub.com/prisma/prisma/issues/14759) - [findFirstOrThrow / findUniqueOrThrow errors are not reported via `error` event](https://togithub.com/prisma/prisma/issues/14933) - [wrong error message/header on multiple table upsert using transaction](https://togithub.com/prisma/prisma/issues/15433) - [Args are out of sync with the action type for count when creating prisma middeware](https://togithub.com/prisma/prisma/issues/15644) - [“Transaction API error: Transaction not found”](https://togithub.com/prisma/prisma/issues/16050) - [Add `Prisma.TransactionClient` to `default-index.d.ts`](https://togithub.com/prisma/prisma/issues/16103) - [RangeError: Invalid count value during prisma generate](https://togithub.com/prisma/prisma/issues/16126) - [Prisma Client regression bug after upgrading to 4.6.0: `findMany` errors with `PANIC: index out of bounds: the len is 0 but the index is 0`](https://togithub.com/prisma/prisma/issues/16195) - [`upsert()` with nested selection errors with ` called `Option::unwrap()`on a`None` value ` in 4.6.0](https://togithub.com/prisma/prisma/issues/16196) - [Bug(qe): errors don't get logged](https://togithub.com/prisma/prisma/issues/16226) - [Downloading binaries of 4.6.1 fails with wrong sha256 checksum](https://togithub.com/prisma/prisma/issues/16233) - [Calling `findUnique` concurrently with different key order causes one of them to return null](https://togithub.com/prisma/prisma/issues/16267) - [No way to catch error in `findUniqueOrThrow` via middleware](https://togithub.com/prisma/prisma/issues/16354) - [Test implicit m:n in relation mode `prisma` / Reproduction test for prisma#16390](https://togithub.com/prisma/prisma/issues/16423) ##### Prisma - [\[Multi Schema\] Same model map different schema](https://togithub.com/prisma/prisma/issues/15009) - [Schema: add deprecation warning for datasource property `referentialIntegrity` (renamed to `relationMode`)](https://togithub.com/prisma/prisma/issues/15689) - [Error in migration engine. Reason: \[migration-engine/connectors/sql-migration-connector/src/sql_renderer/postgres_renderer.rs:944:22\] We should only be setting a changed default if there was one on the previous schema and in the next with the same enum. ](https://togithub.com/prisma/prisma/issues/15705) - [`db pull` with `multiSchema` error on schema with 2 models with the same table name but in a different schema](https://togithub.com/prisma/prisma/issues/15800) - [Prisma 4.6.0 drops and recreates enum field when running db push even if the field has not changed](https://togithub.com/prisma/prisma/issues/16180) - [@@map not working on postgress enums starting version 4.6.0](https://togithub.com/prisma/prisma/issues/16209) - [`relationMode`: make feature GA](https://togithub.com/prisma/prisma/issues/16224) - [Add `SetDefault` validation error with warnings when `provider = "mysql"` and `relationMode = "foreignKeys" | default`](https://togithub.com/prisma/prisma/issues/16259) - [Polish `relationMode` validation warning messages ](https://togithub.com/prisma/prisma/issues/16440) - [Add linting/validation warnings for `prisma validate` & `prisma format`](https://togithub.com/prisma/prisma/issues/16441) ##### Prisma Migrate - [What happen with `prisma migrate dev` ](https://togithub.com/prisma/prisma/issues/16220) - [Prisma complains when enum types are not declared in alphabetical order](https://togithub.com/prisma/prisma/issues/16225) ##### Language tools (e.g. VS Code) - [Dim models that are `@@ignore`d and fields that are `@ignore`d](https://togithub.com/prisma/language-tools/issues/689) - [Recommend adding indices to foreign keys when `referentialIntegrity = "prisma"`](https://togithub.com/prisma/language-tools/issues/992) - [PostgreSQL only: Add autocompletion in the datasource block for `extensions` when `postgresqlExtensions` preview feature is set](https://togithub.com/prisma/language-tools/issues/1265) - [language-tools: `relationMode` GA - remove preview feature condition](https://togithub.com/prisma/language-tools/issues/1282) - [feat: for `relationMode="prisma"`, for `@relation`: add a warning if there is no index on the field(s)](https://togithub.com/prisma/language-tools/issues/1296) - [feat: Quick Fix - `relationMode` : missing foreign keys' indexes](https://togithub.com/prisma/language-tools/issues/1297) ##### Prisma Engines - [bug(fmt): quick-fixes break with no newline after model in schema](https://togithub.com/prisma/prisma-engines/issues/3444) #### Credits Huge thanks to [@cmd-johnson](https://togithub.com/cmd-johnson), [@jsoref](https://togithub.com/jsoref), [@miguelgargallo](https://togithub.com/miguelgargallo) for helping! #### Prisma Data Platform We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the following: - **Data Browser** for navigating, editing, and querying data - **Data Proxy** for your database's persistent, reliable, and scalable connection pooling. - **Query Console** for experimenting with queries [Try it out](https://cloud.prisma.io/). Let us know what you think! #### 📺 Join us for another "What's new in Prisma" live stream Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://youtu.be/oWjqeU7fowE) live stream. The stream takes place [on YouTube](https://youtu.be/oWjqeU7fowE) on **Thursday, December 1** at **5 pm Berlin | 8 am San Francisco**. ### [`v4.6.1`](https://togithub.com/prisma/prisma/releases/tag/4.6.1) [Compare Source](https://togithub.com/prisma/prisma/compare/4.6.0...4.6.1) Today, we are issuing the `4.6.1` patch release. #### Fixes in Prisma Client - [Prisma Client regression bug after upgrading to 4.6.0: `findMany` errors with `PANIC: index out of bounds: the len is 0 but the index is 0`](https://togithub.com/prisma/prisma/issues/16195) - [`upsert()` with nested selection errors with ` called `Option::unwrap()`on a`None` value ` in 4.6.0](https://togithub.com/prisma/prisma/issues/16196) #### Fix in Prisma Migrate - [Prisma 4.6.0 drops and recreates enum field when running db push even if the field has not changed](https://togithub.com/prisma/prisma/issues/16180) ### [`v4.6.0`](https://togithub.com/prisma/prisma/releases/tag/4.6.0) [Compare Source](https://togithub.com/prisma/prisma/compare/4.5.0...4.6.0) 🌟 **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.6.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/4.6.0) about the release.** 🌟 #### Highlights ##### Interactive Transactions for Prisma Data Proxy (Preview) In [3.8.0](https://togithub.com/prisma/prisma/releases/tag/3.8.0), we disabled the `interactiveTransactions` [Preview feature](https://www.prisma.io/docs/about/prisma/releases#preview) when using the Prisma Data Proxy. This was because the API was not yet supported. In this release, we're removing the limitation. You can now try the Preview version of [interactive transactions](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions-in-preview) with the Prisma Data Proxy. Re-generate Prisma Client using `prisma generate --data-proxy` after enabling the Preview feature. **Note**: The `interactiveTransactions` Preview feature flag is still needed. We will remove this in a future version when the feature is stable. Try it out and let us know your thoughts in our [interactive transactions feedback GitHub issue](https://togithub.com/prisma/prisma/issues/8664). ##### Native database level upserts for PostgreSQL, SQLite, and CockroachDB Prisma’s upsert is one of its most powerful and most convenient APIs. In this release, Prisma will now default to the native database upsert for PostgreSQL, SQLite, and CockroachDB whenever possible. Prisma will use the native database upsert if: - There are no nested queries in the `upsert`'s `create` and `update` [options](https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#upsert-1) - The query modifies only one model - There is only one unique field in the `upsert`'s `where` option - The unique field in the `where` option and the unique field in the `create` option have the same value Prisma Client's [`upsert`](https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#upsert) operation was implemented on a Prisma-level and did not use the native database implementations like, e.g., `INSERT .. ON CONFLICT .. UPDATE SET`. This allowed Prisma to also upsert nested queries. The Prisma-implementation came at a cost. In some scenarios, it was more likely for a transaction to roll back because of a conflict when multiple `upsert` operations were being executed in parallel, and the multiple queries often took longer than the native database query would have taken. Try it out and let us know what you think. If you run into any issues, don't hesitate to create a [GitHub issue](https://togithub.com/prisma/prisma/issues/new?assignees=\&labels=kind%2Fbug\&template=bug_report.yml). ##### Relation Mode improvements (Preview) In [4.5.0](https://togithub.com/prisma/prisma/releases/tag/4.5.0), we renamed the "Referential Integrity" Preview feature to "Relation Mode". We also changed the `datasource` property name of the feature to `relationMode`. In this release, we fixed all remaining known bugs of `relationMode = "prisma"` and cleaned up our documentation. You can now read about [Relation mode](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) on its [own documentation page](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/relation-mode) which is up to date with the implementation. If you encounter any problems [please comment on our feedback issue](https://togithub.com/prisma/prisma/issues/9380). We plan to make this [Generally Available](https://www.prisma.io/docs/about/prisma/releases#generally-available-ga) soon. ##### `extendedWhereUnique` improvements (Preview) In [4.5.0](https://togithub.com/prisma/prisma/releases/tag/4.5.0), we introduced the `extendedWhereUnique` Preview feature to allow filtering for non-unique properties in unique where queries. In this release, we're adding new rules to decide when concurrent `findUnique` queries get batched into a `findMany` query. Unfortunately, we forgot to adapt our `findUnique` [query batch optimization](https://www.prisma.io/docs/guides/performance-and-optimization/query-optimization-performance#solving-the-n1-problem), which turns multiple concurrent `findUnique` queries into a single `findMany` query when possible — [GitHub issue](https://togithub.com/prisma/prisma/issues/15934). Therefore, `findUnique` queries will get batched into a `findMany` query if: - All criteria of the filter must be on scalar fields (unique ***or*** non-unique) of the same model you're querying - All criteria must use the equal's filter, whether that's via the shorthand or explicit syntax (`where: { field:Configuration
đź“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.