Prisma

Latest version: v0.15.0

Safety actively analyzes 710445 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 17 of 44

2.29.1

Today, we are issuing the `2.29.1` patch release.

Fixes

Prisma Client

- [Cannot find namespace 'debug' in 2.29.0](https://github.com/prisma/engines-wrapper/issues/128)
- [Interactive transactions not working with $queryRaw and $executeRaw in 2.29.0](https://github.com/prisma/prisma/issues/8717)
- [Calling .catch() or .finally() on a prisma client model query does not fire the request in 2.29.0](https://github.com/prisma/prisma/issues/8718)

2.29.0

Today, we are excited to share the `2.29.0` stable release 🎉

🌟 **Help us spread the word about Prisma by starring the repo or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20prisma%20release%20v2.29.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/2.29.0) about the release.** 🌟

Major improvements & new features

Interactive Transactions are now in Preview

Today we’re introducing Interactive Transactions – one of our most debated [feature requests](https://github.com/prisma/prisma/issues/1844).

Interactive Transactions are a double-edged sword. While they allow you to ignore a class of errors that could otherwise occur with concurrent database access, they impose constraints on performance and scalability.

While we believe there are [better alternative approaches](https://www.prisma.io/blog/how-prisma-supports-transactions-x45s1d5l0ww1#transaction-patterns-and-better-alternatives), we certainly want to ensure people who absolutely need them have the option available.

You can opt-in to Interactive Transactions by setting the `interactiveTransactions` preview feature in your Prisma Schema:

prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
}


Note that the interactive transactions API does not support controlling isolation levels or locking for now.

You can find out more about implementing use cases with transactions in [the docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions), and [share your feedback](https://github.com/prisma/prisma/issues/8664).


Named Constraints are now in Preview

Named Constraints allow you to represent (when using introspection) and specify (when using Prisma Migrate) the names of constraints of the underlying database schema in your Prisma schema.

Before this release, you could only specify the underlying database constraint names for [`unique`](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#unique-1) and [`index`](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#index). This meant that you didn't have control over all constraint names in the database schema. In projects that adopted Prisma with introspection, some constraint names from the database were not represented in the Prisma schema. This could lead to the database schema across environments getting out of sync when one environment was introspected, and another was created with Prisma Migrate and had different constraint names.

Starting with this release, you can specify the underlying database constraint names for [`id`](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#id), `id`, `unique`, and `relation` constraints.

You can opt-in to Named Constraints by adding the `namedConstraints` preview feature to your Prisma Schema:

prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["namedConstraints"]
}


After enabling the `namedConstraints` preview flag, you can specify the names of constraints in the database schema using the `map` attribute:

- `id(map: "custom_primary_key_constraint_name")`
- `id([field1, field2], map: "custom_compound_primary_key_name")`
- `unique(map: "custom_unique_constraint_name")`
- `unique([field1, field2], map: "custom_compound_unique_constraint_name")`
- `index([field1, field2], map: "custom_index_name")`
- `relation(fields: [fieldId], references: [id], map: "custom_foreign_key_name")`

After specifying the `map` attribute, Prisma Migrate will use it when creating migrations.

When using `prisma db pull` with `namedConstraints`, these names will be automatically populated in your Prisma schema unless they match our default naming convention (which follows the Postgres convention). When handwriting a Prisma schema, these names are optional and will alternatively be filled with the default names by Prisma under the hood.

The `name` argument in `unique` and `id`

In addition to the `map` argument, the `unique` and the `id` attributes have the `name` argument (optional) that Prisma uses to generate the `WhereUnique` argument in the Prisma Client API.

> **Note:** You can use both `name` and `map` together, e.g. `unique([firstName, lastName], name: "NameOfWhereUniqueArg", map: "NameOfUniqueConstraintInDB")`

For example, given the following model:

prisma
model User {
firstName String
lastName String

id([firstName, lastName])
}


The following Prisma Client query is valid:

ts
const user = await prisma.user.findUnique({
where: {
// firstName_lastName is the default `name`
firstName_lastName: {
firstName: 'Ada',
lastName: 'Lovelace',
},
},
})


By adding the `name` argument to the `id` attribute:

diff
model User {
firstName String
lastName String

- id([firstName, lastName])
+ id([firstName, lastName], name: "fullname")
}


The following query is valid:

ts
const user = await prisma.user.findUnique({
where: {
// fullname comes from the name argument
fullname: {
firstName: 'Ada',
lastName: 'Lovelace',
},
},
})


Note: For the `unique` attribute this functionality was already available in previous releases. For `id` this is new.

---

You can learn more about `namedConstraints` in [our documentation](https://prisma.io/docs/concepts/components/prisma-schema/names-in-underlying-database).

Please check our [upgrade guide](https://prisma.io/docs/guides/upgrade-guides/upgrading-to-use-preview-features/enabling-named-constraints) before enabling the preview flag and running migrate operations for the first time. It explains what to do if you either want to keep the existing names in your database or want to switch to the default names for a cleaner Prisma schema.

Prisma Adopts Semantic Versioning (SemVer)

As previously announced, we are adjusting our release policy to adhere more strictly to [Semantic Versioning](https://semver.org/).

In the future, breaking changes in the stable development surface i.e. [General Availability](https://www.prisma.io/docs/about/releases#generally-available-ga) will only be rolled out with major version increments.

You can learn more about the change in the [announcement blog post](https://www.prisma.io/blog/prisma-adopts-semver-strictly).

Fixes and improvements

Prisma Client

- [API for interactive transactions with dependencies between write-operations](https://github.com/prisma/prisma/issues/1844)
- [[SQL Server] add validation for disallowed relationships (e.g. cyclic)](https://github.com/prisma/prisma/issues/4580)
- [The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.](https://github.com/prisma/prisma/issues/6693)
- [Transaction with bad input should rollback (when using middleware)](https://github.com/prisma/prisma/issues/6705)
- [PANIC in libs/prisma-models/src/record.rs:161:30 | Invalid coercion encountered: ConversionFailure("Bytes](https://github.com/prisma/prisma/issues/7097)
- [Unique constraint error inside a transaction throws unparsed error (but works fine when using Node API)](https://github.com/prisma/prisma/issues/7326)
- [No PrismaClientKnownRequestError if error in transaction](https://github.com/prisma/prisma/issues/7399)
- [No PrismaClientKnownRequestError when unique constraint fails in transaction](https://github.com/prisma/prisma/issues/7786)
- ["Mongo is not yet supported" in databaseTypeToConnectorType()](https://github.com/prisma/prisma/issues/8261)
- [Nested update with `updateMany` does not update the updatedAt timestamps for related records properly](https://github.com/prisma/prisma/issues/8265)
- [Enable Type Discovery](https://github.com/prisma/prisma/issues/8443)

Prisma Migrate

- [Failure creating a migration with MSSQL: `Introducing FOREIGN KEY constraint '...' on table '...' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.`](https://github.com/prisma/prisma/issues/5782)
- [Migration checksum EOL-independent](https://github.com/prisma/prisma/issues/7101)
- [need to run db push twice in order to apply changes](https://github.com/prisma/prisma/issues/7411)
- [Modifying enum value in Postgres causes an error](https://github.com/prisma/prisma/issues/7712)
- [Investigate and remove usage of `--forceExit`](https://github.com/prisma/prisma/issues/7795)
- [Removing element from enum not working](https://github.com/prisma/prisma/issues/8137)
- [Error: Error in migration engine. Reason: [migration-engine/connectors/sql-migration-connector/src/sql_renderer/mssql_renderer.rs:394:9] not yet implemented: DROP TYPE [dbo].[syspolicy_target_filters_type] ](https://github.com/prisma/prisma/issues/8185)
- [Re-Introspection: `introspect --url` outputs additional lines which make output result unusable](https://github.com/prisma/prisma/issues/8321)
- [Check validity of having Unique Constraint and Primary Key Constraint on the same Column on SqlServer](https://github.com/prisma/prisma/issues/8463)
- [`config.datasources[0].provider` from GetConfig needs to be a string and not a string[]](https://github.com/prisma/prisma/issues/8467)
- [SQL Server: Unable to rename a column referenced by a relation](https://github.com/prisma/prisma/issues/8539)
- [Remove skipped SQL Server tests](https://github.com/prisma/prisma/issues/8544)
- [error: Error validating model "foo": The custom name `bar` specified for the `unique` attribute is already used as a name for a field. Please choose a different name.](https://github.com/prisma/prisma/issues/8576)

Credits

Huge thanks to benkenawell for helping!

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=Dt9uEq1WVvQ) livestream.

The stream takes place [on Youtube](https://www.youtube.com/watch?v=Dt9uEq1WVvQ) on **Thursday, March 04** at **5pm Berlin | 8am San Francisco**.

2.28.0

Today, we are excited to share the `2.28.0` stable release 🎉

🌟 **Help us spread the word about Prisma by starring the repo ☝️ or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20prisma%20release%20v2.28.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/2.28.0) about the release.** 🌟 

MongoDB improvements 🚀

Thanks to your feedback, we fixed a handful of bugs reported on **the MongoDB connector (Preview)**:

- Concurrent `findUnique` queries leading to an error [8276](https://github.com/prisma/prisma/issues/8276)
- Filtering by relations wasn't working properly [7057](https://github.com/prisma/prisma/issues/7057)
- Filtering on an array of IDs [6998](https://github.com/prisma/prisma/issues/6998)

Please keep reporting issues to our team and help to bring MongoDB support closer to GA!

Prisma Adopts Semantic Versioning (SemVer)

We are adjusting our release policy to adhere more strictly to [Semantic Versioning](https://semver.org/).

In the future, breaking changes in the stable development surface i.e. [General Availability](https://www.prisma.io/docs/about/releases#generally-available-ga) will only be rolled out with major version increments.

You can learn more about the change in the [announcement blog post](https://www.prisma.io/blog/prisma-adopts-semver-strictly).

Create new Prisma projects in under 3 minutes ⏳

The latest release of the [Prisma Data Platform](https://cloud.prisma.io/) enables you to create new Prisma projects and provision a database in under 3 minutes.

The Prisma Data Platform already allows you to:
- Explore data in the database using the [data browser](https://www.prisma.io/blog/prisma-online-data-browser-ejgg5c8p3u4x).
- Add other users to it, such as your teammates or your clients.
- Assign users one of four roles: Admin, Developer, Collaborator, Viewer.
- View and edit your data collaboratively online.

**The new onboarding flow makes it possible to get started with Prisma quickly for new Prisma projects!** 🚀

When creating a new Prisma project, the Prisma Data Platform allows you to:
- Choose a Prisma schema from a selection of our templates.
- Create a free PostgreSQL database on Heroku.
- Populate the database with seed data.

If you already have a Prisma project, you can continue to import it from GitHub and connect it to your database.

This whole process now takes less than 3 minutes to set up, so we’re looking forward to seeing how you will use this feature for your prototyping and production needs.

If you have any issues or questions, let us know by [opening a GitHub issue](https://github.com/prisma/studio/issues?q=is%3Aopen+is%3Aissue+label%3A%22topic%3A+hosted+data+browser%22).

Quick overview
If you have a Heroku account, we can create a free Postgres database for you:

![Prisma cloud onboarding](https://user-images.githubusercontent.com/27310414/127045405-b2d6f4c3-5970-439f-9c8f-4f6d534b10c4.png)

Start your project with a schema from our templates:

![schema_templates](https://user-images.githubusercontent.com/27310414/127045541-ba5df553-bfc5-4d6f-be5f-f2f18abe626f.png)

Interested in Prisma’s upcoming Data Proxy for serverless backends? Get notified! 👀

Database connection management in serverless backends is challenging: taming the number of database connections, additional query latencies for setting up connections, etc.

At Prisma, we are working on a Prisma Data Proxy that makes integrating traditional relational and NoSQL databases in serverless Prisma-backed applications a breeze. If you are interested, you can sign up to get notified of our upcoming Early Access Program here:

[https://pris.ly/prisma-data-proxy](https://pris.ly/prisma-data-proxy)

Fixes and improvements

Prisma Client

- [PANIC in query-engine/connectors/mongodb-query-connector/src/value.rs:100:24 not yet implemented: (ObjectId, List([String("609675d400e7693e0090e48c")]))](https://github.com/prisma/prisma/issues/6998)
- [MongoDB: Filtering by relation returns no results](https://github.com/prisma/prisma/issues/7057)
- [MongoDB: 2 queries for findUnique lead to error](https://github.com/prisma/prisma/issues/8276)


Prisma Migrate

- [Using render.com database for `migrate dev` leads to error message `ERROR: cannot drop view pg_buffercache because extension pg_buffercache requires it HINT: You can drop extension pg_buffercache instead.`](https://github.com/prisma/prisma/issues/8217)


Prisma Studio

- [Can't open Prisma Studio from WSL 2](https://github.com/prisma/studio/issues/719)
- [Unable to get DMMF from Prisma Client](https://github.com/prisma/studio/issues/720)
- [Prisma Studio fails to add or update record in database when it contains `"`.](https://github.com/prisma/studio/issues/722)
- [Scrolling & searching in initial schema list not working](https://github.com/prisma/studio/issues/723)
- [Fatal error on latest version (0.410.0) on Windows](https://github.com/prisma/studio/issues/725)
- [Ability to remove invalid/unused schemes](https://github.com/prisma/studio/issues/726)
- [fields with updatedAt are not behaving as expected](https://github.com/prisma/studio/issues/728)
- [Error starting Prisma Client: { "message": "\n Error: spawn typegraphql-prisma ENOENT\n at notFoundError ](https://github.com/prisma/studio/issues/730)
- [prisma studio error after installing latest version](https://github.com/prisma/studio/issues/732)
- [Sort models alphabetically (or allow multiple sorting options)](https://github.com/prisma/studio/issues/748)


Credits

Huge thanks to ShubhankarKG, hehex9 for helping!

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=PptCfa73Y1k) livestream.

The stream takes place [on Youtube](https://www.youtube.com/watch?v=PptCfa73Y1k) on **Thursday, July 15** at **5pm Berlin | 8am San Francisco**.

2.27.0

Today, we are excited to share the `2.27.0` stable release 🎉

🌟 **Help us spread the word about Prisma by starring the repo ☝️ or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20prisma%20release%20v2.27.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/2.27.0) about the release.** 🌟 

Major improvements & new features

MongoDB is Now in Preview 🎉

We're thrilled to announce that Prisma now has [Preview support](https://www.prisma.io/docs/about/releases/#preview) for [MongoDB](https://mongodb.com). Here's how to get started:

Inside your `schema.prisma` file, you'll need to set the database provider to `mongodb`. You'll also need to add `mongoDb` to the `previewFeatures` property in the `generator` block:

prisma
// Set the database provider to "mongodb"
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}

// We want to generate a Prisma Client
// Since mongodb is a preview feature, we need to enable it.
generator client {
provider = "prisma-client-js"
previewFeatures = ["mongoDb"]
}

// Create our Post model which will be mapped to a collection in the database.
// All posts have a required `title`, `slug` and `body` fields.
// The id attributes tell Prisma it's a primary key and to generate
// object ids by default when inserting posts.
model Post {
id String id default(dbgenerated()) map("_id") db.ObjectId
slug String unique
title String
body String
}


Next, you'll need to add a database connection string to your `.env` file. We recommend using [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) to spin up a MongoDB database for free. Set the `DATABASE_URL` to the connection string you got from MongoDB Atlas, it should be similar to the following string:

env
DATABASE_URL="mongodb+srv://admin:<password>cluster0.quvqo.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"


> ❗️ Don't forget to include the username and password you set while creating the database in the connection string, otherwise you won't be able to connect to it.

Then you can run `npx prisma generate` to generate a MongoDB-compatible Prisma Client. The Prisma Client API is the same for Mongo as it is for other supported relational databases (PostgreSQL, MySQL, SQLite and Microsoft SQL Server).

To test that everything works, you can run the following script:

js
import { PrismaClient } from "prisma/client"
const prisma = new PrismaClient()

async function main() {
// Create the first post
await prisma.post.create({
data: {
title: "Prisma <3 MongoDB",
slug: "prisma-loves-mongodb",
body: "This is my first post. Isn't MongoDB + Prisma awesome?!",
},
})
// Log our posts showing nested structures
console.dir(posts, { depth: Infinity })
}

main()
.catch(console.error)
.finally(() => prisma.$disconnect())


You should see a new post created and added to your database! You can use [Prisma Studio](https://prisma.io/studio) to view the record you just added by running `npx prisma studio`.

This is just the tip of the iceberg. Learn more in our [Getting Started Guide](https://prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb-typescript-mongodb).

We would love to know your feedback! If you have any comments or run into any problems we're available in [this issue](https://github.com/prisma/prisma/issues/8241). You can also browse existing issues that have the [MongoDB label](https://github.com/prisma/prisma/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22topic%3A+mongodb%22).

Prisma native support for M1 Macs 🚀

This one's for our Mac users. Prisma now runs natively on the new M1 chips. Best of all, there's nothing to configure, it just works. Enjoy the speed bump!

Fixes and improvements

Prisma Client

- [Provide precompiled binaries for Mac's M1 ARM architecture](https://github.com/prisma/prisma/issues/5245)
- [Prisma Format: Fill in native type attributes on foreign key relations](https://github.com/prisma/prisma/issues/6717)
- [Entity types cannot be resolved in PNPM monorepo](https://github.com/prisma/prisma/issues/7484)
- [2.26.0 and `pnpm` do not play well together](https://github.com/prisma/prisma/issues/7934)
- [LRT: Break down the design into discrete tasks](https://github.com/prisma/prisma/issues/7957)


Prisma Migrate

- [Handle error `ERROR 70100 (1317): foreign key constraints are not allowed, see https://code.openark.org/blog/mysql/the-problem-with-mysql-foreign-key-constraints-in-online-schema-changes`](https://github.com/prisma/prisma/issues/7384)
- [Handle error `ERROR HY000 (1105): direct DDL is disabled`](https://github.com/prisma/prisma/issues/7385)
- [db push --force-reset is not creating database if it doesn't exist](https://github.com/prisma/prisma/issues/7440)
- [Migrate tries to drop + recreate column when changing type from TEXT -> CITEXT (Postgres)](https://github.com/prisma/prisma/issues/7536)
- [SQL Server Introspection lists XML indices which are then rejected by schema validation](https://github.com/prisma/prisma/issues/7571)
- [`migrate dev` and PostGis Views](https://github.com/prisma/prisma/issues/7764)
- [DB pull & migration doesn't work for MongoDB](https://github.com/prisma/prisma/issues/7849)
- [`prisma init` for datasource providers in Preview/EarlyAccess](https://github.com/prisma/prisma/issues/7900)
- [referentialActions: Only underline offending part of line when using referential actions, but not having preview feature enabled](https://github.com/prisma/prisma/issues/7947)
- [Better error when introspecting MongoDB](https://github.com/prisma/prisma/issues/8012)


📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=Z_EcSt_0U0o) livestream.

The stream takes place [on Youtube](https://www.youtube.com/watch?v=Z_EcSt_0U0o) on **Thursday, July 15** at **5pm Berlin | 8am San Francisco**.

2.26.0

Today, we are excited to share the `2.26.0` stable release 🎉

🌟 **Help us spread the word about Prisma by starring the repo or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20prisma%20release%20v2.26.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/2.26.0) about the release.** 🌟 

Major improvements & new features

Referential Actions now enable cascading deletes and updates (Preview)

In this release we are introducing a new feature in Preview which enables fine-grained control over referential actions `ON DELETE` and `ON UPDATE` for the foreign keys supporting relations in Prisma models.

Current behavior

Until now, Prisma created a foreign key for each relation between Prisma models with the following defaults: `ON DELETE CASCADE ON UPDATE CASCADE`. In addition, when invoking the `delete()` or `deleteAll()` methods, Prisma Client performs runtime checks and will prevent the deletion of records on required relations if there are related objects referencing it, effectively preventing the cascade delete behavior. When using raw SQL queries for deletion, Prisma Client won't perform any checks, and deleting a referenced object will effectively cause the deletion of the referencing objects.

Example:

prisma
model User {
id String id
posts Post[]
}

model Post {
id String id
authorId String
author User relation(fields: [authorId])
}


`prisma.user.delete(...)` and `prisma.user.deleteAll()` will fail if the user has posts.

Using raw SQL, e.g. using `$queryRaw()` to delete the user will trigger the deletion of its posts.

New behavior

> ⚠️ Turning on this feature could, when using `delete()` and `deleteMany()` operations, delete more data than before under certain circumstances. Make sure you read down below to understand why and anticipate these changes.

The feature can be enabled by setting the preview feature flag `referentialActions` in the `generator` block of Prisma Client in your Prisma schema file:

prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialActions"]
}


With the feature enabled, the behavior is now the following:

- **It's possible to choose specific referential actions for the foreign keys in relations**. Prisma Migrate, `prisma db push`, and introspection will set these in the database schema, e.g. `relation(... onDelete: SetNull)` will set translate to `ON DELETE SET NULL` on the corresponding foreign key. See *Syntax* section below.
- When the `onDelete` or `onUpdate` attributes in `relation` are not present, **default values** are used:
- `ON DELETE RESTRICT` (`NO ACTION` on SQL Server) for required relations
- `ON DELETE SET NULL` for optional relations
- `ON UPDATE CASCADE` for all relations regardless if optional or required.
- **Prisma Migrate, `prisma db push`, and introspection will rely on the syntax and default values above to keep the referential actions between Prisma schema and database schema in sync**.
- **Prisma Client no longer performs any checks before deleting records when invoking `delete()` or `deleteAll()` methods**. Deleting referenced objects will succeed or not depending on the underlying foreign keys of relations, e.g. by default deletion will be prevented by the database because it's set to `ON DELETE RESTRICT`, but will succeed if set to `ON DELETE CASCADE`.
- **Upgrade path**: If developers don't specify custom `onDelete` or `onUpdate` attributes in the Prisma schema, the next time the database is updated with Prisma Migrate or `prisma db push`, the database schema will be updated to use the default values on all foreign keys, `ON DELETE RESTRICT ON UPDATE CASCADE` (`ON DELETE NO ACTION ON UPDATE CASCADE` on SQL Server).
Please note that until then, if the database schema is managed using Prisma Migrate or `prisma db push`, the existing defaults are probably in place (`ON DELETE CASCADE ON UPDATE CASCADE`), and **this could lead to deletion of records in conditions where a deletion was previously prevented by Prisma Client** until the foreign key constraints are updated.

Syntax

The semantics of `onDelete` and `onUpdate` are almost exactly how SQL expresses `ON UPDATE` and `ON DELETE`. For the example below:

- If the related author (`User`) of a `Post` is deleted (`onDelete`), delete all `Post` rows that are referencing the deleted `User` (`Cascade`).
- If the `id` field of the related `User` is updated, also update `authorId` of all `Post`s that reference that `User`.

prisma
model User {
id String id
posts Post[]
}

model Post {
id String id
authorId String
author User relation(fields: [authorId], onDelete: Cascade, onUpdate: Cascade)
}


Possible keywords for `onDelete` and `onUpdate` are: `Cascade`, `Restrict` (except SQL Server), `NoAction`, `SetNull`, `SetDefault`.

<!--- For a detailed reference, please [read our docs](https://www.prisma.io/docs/concepts/components/prisma-schema/referential-actions). --->

If you run into any questions or have any feedback, we're available in [this issue](https://github.com/prisma/prisma/issues/7816).

Limitations

- Certain combinations of referential actions and required/optional relations are incompatible. Example: Using `SetNull` on a required relation will lead to database errors when deleting referenced records because the non-nullable constraint would be violated.
- Referential actions can not be specified on relations in [implicit many-to-many relations](https://www.prisma.io/docs/concepts/components/prisma-schema/relations#implicit-many-to-many-relations). This limitation can be worked around by switching to [explicit many-to-many](https://www.prisma.io/docs/concepts/components/prisma-schema/relations#explicit-many-to-many-relations) relations and specifying the referential actions on the relations in the [relations table](https://www.prisma.io/docs/concepts/components/prisma-schema/relations#relation-tables).

`prisma init` now accepts a `--datasource-provider` argument

The [`prisma init`](https://www.prisma.io/docs/reference/api-reference/command-reference#init) command now accepts a `--datasource-provider` argument that lets you configure the default `provider` for the initially generated `datasource` block in your Prisma schema. The possible values for this argument are equivalent to the [allowed values](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#fields) for the `provider` field on `datasource` blocks:

- `postgresql` (default)
- `mysql`
- `sqlite`
- `sqlserver` ([Preview](https://github.com/prisma/prisma/issues/4039), needs the `microsoftSqlServer` preview feature flag)

Here's an example that shows how to configure the initial Prisma schema skeleton with a SQLite database:


npx prisma init --datasource-provider sqlite


Node-API Improvements

The Prisma Client currently communicates to Prisma's Query Engine over either HTTP or Unix domain sockets. After some experimentation, we realized we can improve this communication overhead by using [Node-API](https://nodejs.org/api/n-api.html), which provides direct memory access across processes.

We've been working the last couple of weeks to get ready to make Node-API the default way we communicate with the Query Engine. To prepare for this change, we fixed a bunch of bugs and we'd love for you to give it another try:

prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["nApi"]
}


Right now we're still compiling benchmarks, but you should see a nice speed boost by opting into Node-API. You can reach us in [this issue](https://github.com/prisma/prisma/issues/6301) if you run into anything!

Fixes and improvements

Prisma Client

- [No way to cascade delete when the foreign key is non-nullable](https://github.com/prisma/prisma/issues/2057)
- [Delete to use the include attribute to cascade deletes](https://github.com/prisma/prisma/issues/2092)
- [Delete of "parent" should not be prevented if it will cascade delete "children" on required relations](https://github.com/prisma/prisma/issues/4650)
- [Enable cascading delete behavior with onDelete: CASCADE](https://github.com/prisma/prisma/issues/4711)
- [Add TypeScript version check](https://github.com/prisma/prisma/issues/5728)
- [Error when using `join` raw query helper with SQL Server](https://github.com/prisma/prisma/issues/6276)
- [Using current CLI and older Client `generate` gives `TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object` or `TypeError: outputDir.endsWith is not a function` error and no helpful output](https://github.com/prisma/prisma/issues/6535)
- [Prisma 2.24.0 throws error `Query engine exited with code 101 - thread 'main' panicked at 'Could not open datamodel file "/schema.prisma"...'`](https://github.com/prisma/prisma/issues/7439)
- [Fully test Node-API libraries](https://github.com/prisma/prisma/issues/7564)
- [Flaky `Engine is not yet connected.` CI test with Node-API](https://github.com/prisma/prisma/issues/7569)
- [Internal: client fixtures fail to generate](https://github.com/prisma/prisma/issues/7652)
- [Latest Prisma (2.24.x) version breaks some pnpm projects when generating models](https://github.com/prisma/prisma/issues/7661)
- [Review all tests for engine types](https://github.com/prisma/prisma/issues/7695)


Prisma Migrate

- [Cascade deletes doesn't work on many to many relations](https://github.com/prisma/prisma/issues/2328)
- [Support for configuring referential actions (on delete, on cascade) in Prisma Schema Language](https://github.com/prisma/prisma/issues/2810)
- [Implicit relation tables always have `onDelete CASCADE`, this should be configurable.](https://github.com/prisma/prisma/issues/4166)
- [Failure creating a migration with MSSQL: `Introducing FOREIGN KEY constraint '...' on table '...' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.`](https://github.com/prisma/prisma/issues/5782)
- [Introspection migration adds ON UPDATE CASCADE ON DELETE SET NULL to foreign key constraints](https://github.com/prisma/prisma/issues/6999)
- [The meaning of "arity" in Migrate drift summaries is not clear](https://github.com/prisma/prisma/issues/7675)
- [Display the position of migration errors in the script on Postgres](https://github.com/prisma/prisma/issues/7908)


Prisma

- [Proposal: onDelete and onUpdate relation properties](https://github.com/prisma/prisma/issues/6996)
- [2.23.0 can not recognize `binaryTargets: env("..")` inside `generator client` section](https://github.com/prisma/prisma/issues/7295)


Credits

Huge thanks to B2o5T for helping!

🌎 Prisma Day is happening today!

[Prisma Day](https://prisma.io/day) is a two-day event of talks and workshops by members of the Prisma community, on modern application development and databases. It's taking place *June 29-30th* and is entirely online.

- June 29th: Workshops
- June 30th: Talks

We look forward to seeing you there!

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=i8TqB5ofVaM) livestream.

The stream takes place [on Youtube](https://www.youtube.com/watch?v=i8TqB5ofVaM) on **Thursday, July 01** at **5pm Berlin | 8am San Francisco**.

2.25.0

Today, we are excited to share the `2.25.0` stable release 🎉

🌟 **Help us spread the word about Prisma by starring the repo or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20prisma%20release%20v2.25.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/2.25.0) about the release.** 🌟 

Major improvements & new features

Human-readable drift diagnostics for `prisma migrate dev`

Database schema drift occurs when your database schema is out of sync with your migration history, i.e. the database schema has _drifted away_ from the source of truth.

With this release, we improve the way how the drift is printed to the console when detected in the `prisma migrate dev` command. While this is the only command that uses this notation in today's release, we plan to use it in other places where it would be useful for debugging in the future.

Here is an example of how the drift is presented with the new format:


[*] Changed the `Color` enum
[+] Added variant `TRANSPARENT`
[-] Removed variant `RED`

[*] Changed the `Cat` table
[-] Removed column `color`
[+] Added column `vaccinated`

[*] Changed the `Dog` table
[-] Dropped the primary key on columns (id)
[-] Removed column `name`
[+] Added column `weight`
[*] Altered column `isGoodDog` (arity changed from Nullable to Required, default changed from `None` to `Some(Value(Boolean(true)))`)
[+] Added unique index on columns (weight)


Support for `.env` files in Prisma Client Go

You can now use a `.env` file with Prisma Client Go. This makes it easier to keep database credentials outside your Prisma schema and potentially work with multiple clients at the same time:


example/
├── .env
├── main.go
└── schema.prisma


Learn more about using the `.env` file in [our documentation](https://www.prisma.io/docs/concepts/more/environment-variables/#using-env-files).


Breaking change

Dropping support for Node.js v10

Node.js v10 reached End of Life on April 30th 2021. Many of our dependencies have already dropped support for Node.js v10 so staying up-to-date requires us to drop Node.js v10, too.

We recommend upgrading to Node.js v14 or greater for long-term support. You can learn more about Node.js releases on [this page](https://nodejs.org/en/about/releases/).

Fixes and improvements

Prisma Client

- [[Errors] New common error from malformed connection string](https://github.com/prisma/prisma/issues/3405)
- [prisma client doesn't work with serverless-next.js](https://github.com/prisma/prisma/issues/6032)
- [Failed to run future: no available capacity / QueueFull](https://github.com/prisma/prisma/issues/6683)
- [Clean up middleware implementation](https://github.com/prisma/prisma/issues/6968)
- [Possible Node API performance regression with concurrency](https://github.com/prisma/prisma/issues/7382)
- [Dropping Node v10 support (LTS reached EndOfLife)](https://github.com/prisma/prisma/issues/7394)
- [Performance regression with napi for high concurrency](https://github.com/prisma/prisma/issues/7404)
- [In 2.24.0 `createMany` errors with: `PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:95:60called `Result::unwrap()` on an `Err` value: ScalarFieldNotFound { name: "updated_at", model: "FundMangerTeamMemberExperience" }`](https://github.com/prisma/prisma/issues/7416)
- [test: snapshot `params` in Middleware tests](https://github.com/prisma/prisma/issues/7437)
- [Running `prisma generate` doesn't install prisma client 2.24.x](https://github.com/prisma/prisma/issues/7579)
- [Middleware + $transactions do not play well together](https://github.com/prisma/prisma/issues/7584)
- [Environment variable not found](https://github.com/prisma/prisma/issues/7629)


Prisma Migrate

- [Feature request - Migrate: When Drift Detected -> give more Details than just the rollback script](https://github.com/prisma/prisma/issues/5873)
- [Error: [introspection-engine\connectors\sql-introspection-connector\src\introspection_helpers.rs:188:64] called `Option::unwrap()` on a `None` value ](https://github.com/prisma/prisma/issues/6738)
- [Generate log file with Drift detected info for troubleshooting purpose](https://github.com/prisma/prisma/issues/6776)
- [`db push` / `migrate` is hiding the binary download process during `generate`, leading to confusion](https://github.com/prisma/prisma/issues/6926)
- [Shadow vs. main database check does not consider the port](https://github.com/prisma/prisma/issues/7216)
- [Re-Introspection removes `shadowDatabaseUrl` from schema](https://github.com/prisma/prisma/issues/7337)


Prisma Studio

- [Prisma Studio not working with napi preview feature](https://github.com/prisma/studio/issues/662)
- [Crash in simple datasource only schema](https://github.com/prisma/studio/issues/701)
- [Prisma studio requires having prisma client installed when it shouldn't](https://github.com/prisma/studio/issues/703)


Credits

Huge thanks to 82600417, SuryaElavazhagan, psavan1655 for helping!

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=Fkj3Zaow5fQ&ab_channel=Prisma) livestream.

The stream takes place [on Youtube](https://www.youtube.com/watch?v=Fkj3Zaow5fQ&ab_channel=Prisma) on **Thursday, June 17** at **5pm Berlin | 8am San Francisco**.

🌎 Prisma Day is coming

Save the date for [Prisma Day 2021](https://www.prisma.io/day) and join us for two days of talks and workshops by the most exciting members of the Prisma community.

- June 29th: Workshops
- June 30th: Talks

We look forward to seeing you there!

Page 17 of 44

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.