Prisma

Latest version: v0.15.0

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

Scan your dependencies

Page 3 of 44

5.14.0

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

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

Highlights

Share your feedback about Prisma ORM

We want to know how you like working with Prisma ORM in your projects! Please [take our 2min survey](https://pris.ly/orm/survey/release-5-14) and let us know what you like or where we can improve 🙏

`createManyAndReturn()`

We’re happy to announce the availability of a new, top-level Prisma Client query: `createManyAndReturn()`. It works similarly to `createMany()` but uses a `RETURNING` clause in the SQL query to retrieve the records that were just created.

Here’s an example of creating multiple posts and then immediately returning those posts.

tsx
const postBodies = req.json()['posts']

const posts = prisma.post.createManyAndReturn({
data: postBodies
});

return posts


Additionally,`createManyAndReturn()` supports the same options as `findMany()`, such as the ability to return only specific fields.

tsx
const postBodies = req.json()['posts']

const postTitles = prisma.post.createManyAndReturn({
data: postBodies,
select: {
title: true,
},
});

return postTitles


Full documentation for this feature can be found [in the Prisma Client API Reference](https://www.prisma.io/docs/orm/reference/prisma-client-reference#createmanyandreturn).

**Note**: Because `createManyAndReturn()` uses the `RETURNING` clause, it is only supported by PostgreSQL, CockroachDB, and SQLite databases. At this time, `relationLoadStrategy: join` is not supported in `createManyAndReturn()` queries.

MongoDB performance improvements

Previously, Prisma ORM suffered from performance issues when using the `in` operator or when including related models in queries against a MongoDB database. These queries were translated by the Prisma query engine in such a way that indexes were skipped and collection scans were used, leading to slower queries especially on large datasets.

With 5.14.0, Prisma ORM now rewrites queries to use a combination of `$or` and `$eq` operators, leading to dramatic performance increases for queries that include `in` operators or relation loading.

Fixes and improvements

Prisma Client

- [`createMany()` should return the created records](https://github.com/prisma/prisma/issues/8131)
- [Generating Prisma client without any model in its schema](https://github.com/prisma/prisma/issues/11582)
- [MongoDB: Performance issue with nested `take` on many-to-one relationship](https://github.com/prisma/prisma/issues/13865)
- [Slow queries on MongoDB using `include` for relations](https://github.com/prisma/prisma/issues/15156)
- [[MongoDB] Performance issue in `findMany()` query execution with `in`](https://github.com/prisma/prisma/issues/15983)
- [MongoDB nested/`include` query slow](https://github.com/prisma/prisma/issues/17142)
- [MongoDB Connector generates queries which do not take advantage of indices.](https://github.com/prisma/prisma/issues/17396)
- [Mongodb Nested Queries Not Using Indexes](https://github.com/prisma/prisma/issues/18025)
- [MongoDB slow delete with `onDelete: SetNull`](https://github.com/prisma/prisma/issues/19169)
- [Slow query with many-to-one relationship on MongoDB](https://github.com/prisma/prisma/issues/20600)
- [`prisma init --with-model`](https://github.com/prisma/prisma/issues/20915)
- [Fixed version of `opentelemetry/*` dependencies](https://github.com/prisma/prisma/issues/21473)
- [Usage of deprecated punycode module](https://github.com/prisma/prisma/issues/21644)
- [Bug: D1 One-to-Many Relation INSERTs fail with `The required connected records were not found.` when using indices](https://github.com/prisma/prisma/issues/23902)

Prisma Migrate

- [Empty `dbgenerated()` still breaking for `Unsupported()` types](https://github.com/prisma/prisma/issues/15654)
- [Validation error when `shadowDatabaseUrl` is identical to `url` (or `directUrl`)](https://github.com/prisma/prisma/issues/16628)
- [MongoDB Query with 'in' condition will cause COLLSCAN, without leveraging indexes](https://github.com/prisma/prisma/issues/19955)
- ["Not Authorised" when directly applying Prisma generated migrations to Cloudflare D1 with `PRAGMA foreign_key_check;`](https://github.com/prisma/prisma/issues/23827)

Language tools (e.g. VS Code)

- [make superior: model generate](https://github.com/prisma/language-tools/issues/1651)
- [Missing code autocomplete for referential actions with mongodb](https://github.com/prisma/language-tools/issues/1676)
- [add codelens provider w/ generate client command](https://github.com/prisma/language-tools/pull/1710)

Company news

Prisma Changelog

Curious about all things Prisma? Be sure to check out the [Prisma Changelog](https://www.prisma.io/changelog) for updates across Prisma's products, including ORM, Accelerate, and Pulse!

New product announcement: Prisma Optimize

With this release, we are excited to introduce a new Prisma product. We’re calling it “Optimize” because that’s what it does! Let your favorite ORM also help you debug the performance of your application.

Check out our [announcement blog post](https://www.prisma.io/blog/prisma-optimize-early-access) for more details, including a demo video.

Credits

Huge thanks to pranayat, yubrot, skyzh, anuraaga, gutyerrez, avallete, ceddy4395, Kayoshi-dev for helping!

5.13.0

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

🌟 **Help us spread the word about Prisma by starring the repo or [posting on X](https://twitter.com/intent/post?text=Check%20out%20the%20latest%20%40prisma%20release%20v5.13.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps%3A%2F%2Fgithub.com%2Fprisma%2Fprisma%2Freleases%2Ftag%2F5.13.0) about the release.**

Highlights

`omit` fields from Prisma Client queries (Preview)

We’re excited to announce Preview support for the `omit` option within the Prisma Client query options. The [highly-requested](https://github.com/prisma/prisma/issues/5042) `omit` feature now allows you to exclude fields that you don’t want to retrieve from the database on a ***per-query basis*.**

By default, when a query returns records, the result includes all scalar fields of the models defined in the Prisma schema. [`select`](https://www.prisma.io/docs/orm/reference/prisma-client-reference#select) can be used to return specific fields, while `omit` can now be used to exclude specific fields. `omit` lives at the same API level and works on all of the same [Prisma Client model queries](https://www.prisma.io/docs/orm/reference/prisma-client-reference#model-queries) as `select`. Note, however, that `omit` and `select` are mutually exclusive. In other words, you can’t use both in the same query.

To get started using `omit`, enable the `omitApi` Preview feature in your Prisma schema:

prisma
// schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}


Be sure to re-generate Prisma Client afterwards:

bash
npx prisma generate


Here is an example of using `omit`:

ts
// Includes all fields except password
await prisma.user.findMany({
omit: {
password: true
},
})


Here is an example of using `omit` with `include`:

ts
// Includes all user fields except user's password and title of user's posts
await prisma.user.findMany({
omit: {
password: true
},
include: {
posts: {
omit: {
title: true
},
},
},
})

<details>
<summary>Expand to view the example Prisma schema</summary>

prisma
model User {
id Int id default(autoincrement())
email String unique
name String?
password String
posts Post[]
}

model Post {
id Int id default(autoincrement())
title String
author User relation(fields: [authorId], references: [id])
authorId Int
}


</details>

Many users have requested a global implementation of `omit`. This request will be accommodated in the future. In the meantime, you can follow the issue [here](https://github.com/prisma/prisma/issues/5042).

**📣 Share your feedback:** [`omitApi` Preview feature](https://github.com/prisma/prisma/discussions/23924)

**📚 Documentation:** [`omit` - Prisma Client API Reference](https://www.prisma.io/docs/orm/reference/prisma-client-reference#omit-preview)

Fixes and improvements

Prisma Migrate

- [Nicer Datamodel Type validation](https://github.com/prisma/prisma/issues/15174)

Prisma Client

- [MySQL `upsert()`: `Internal error: Attempted to serialize empty result.`](https://github.com/prisma/prisma/issues/17982)
- [Mysql `upsert()` fails with "Attempted to serialize empty result."](https://github.com/prisma/prisma/issues/18285)
- [Interactive Transaction API timing out after upgrading from 4.7.0 and above](https://github.com/prisma/prisma/issues/18393)
- [MySQL and SQLite `upsert()`: `Internal error: Attempted to serialize empty result.`](https://github.com/prisma/prisma/issues/19868)
- [MySQL `upsert()`: `Internal error: Attempted to serialize empty result.`](https://github.com/prisma/prisma/issues/20042)
- [MongoDB `upsert()`: `Internal error: Attempted to serialize empty result.`](https://github.com/prisma/prisma/issues/20527)
- [MongoDB `upsert()`: `Internal error: Attempted to serialize empty result`](https://github.com/prisma/prisma/issues/21612)
- [Relation mode + `upsert()`: `Internal error: Attempted to serialize empty result.`](https://github.com/prisma/prisma/issues/22562)
- [`Internal error: Attempted to serialize empty result.` on `upsert()` for `update` case in different databases (when using `relationMode=prisma` explicitly or implicitly [MongoDB])](https://github.com/prisma/prisma/issues/22916)
- [Postgres `upsert(): Internal error: Attempted to serialize empty result` when `relationMode = "prisma"` is used](https://github.com/prisma/prisma/issues/23359)
- [`✘ [ERROR] near "��": syntax error at offset 0` when running `wrangler d1 migrations apply` with Prisma generated migration (on Windows, using Powershell)](https://github.com/prisma/prisma/issues/23702)

Credits

Huge thanks to ospfranco, pranayat, yubrot, skyzh, anuraaga, yehonatanz, arthurfiorette, elithrar, tockn, Kuhave, obiwac for helping!

5.12.1

Today, we are issuing the `5.12.1` patch release to fix two small problems with our [new Cloudflare D1 support](https://www.prisma.io/blog/build-applications-at-the-edge-with-prisma-orm-and-cloudflare-d1-preview).

Fixes in Prisma CLI

Windows-only fix for new D1 specific flags for `migrate diff` and `db pull`

The flags `--from-local-d1` and `--to-local-d1` for `migrate diff` and `--local-d1` to `db pull` we added in 5.12.0 were not working as expected when running on Windows only. This is now fixed.

📚 **Documentation:** [Deploying a Cloudflare worker with D1 and Prisma ORM](https://prisma.io/docs/orm/overview/databases/cloudflare-d1#how-to-connect-to-d1-in-cloudflare-workers-or-cloudflare-pages)

New option for `migrate diff`: `-o` or `--output`

We added a new parameter `--output` to `migrate diff` that can be used to provide a filename into which the output of the command will be written. This is particularly useful for Windows users, using PowerShell, as using `>` to write into a file creates a UTF-16 LE file that can not be read by `wrangler d1 migrations apply`. Using this new option, this problem can be avoided:

sh
npx prisma migrate diff --script --from-empty --to-schema-datamodel ./prisma/schema.prisma --output ./schema.sql


Related issues:

- [`✘ [ERROR] near "��": syntax error at offset 0` when running `wrangler d1 migrations apply` with Prisma generated migration (on Windows, using PowerShell) 23702](https://github.com/prisma/prisma/issues/23702)
- [`prisma migrate resolve --applied` not working on new project, `migration ... could not be found.`](https://github.com/prisma/prisma/issues/17558)

5.12.0

Major changes

* chore(prisma): upgrade prisma to v5.11.0 (1216) steebchen
* chore(prisma): upgrade prisma to v5.12.0 (1232) steebchen

Changes

* docs(getting-started): fix API reference link (1224) steebchen

Contributors

steebchen

----

**Full Changelog**: https://github.com/steebchen/prisma-client-go/compare/v0.35.0...v0.36.0

5.11.0

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

🌟 **Help us spread the word about Prisma by starring the repo ☝️ or [posting on X](https://twitter.com/intent/post?text=Check%20out%20the%20latest%20%40prisma%20release%20v5.11.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps%3A%2F%2Fgithub.com%2Fprisma%2Fprisma%2Freleases%2Ftag%2F5.11.0) about the release.**

Highlights

Edge function support for Cloudflare and Vercel (Preview)

We’re thrilled to announce that support for edge function deployments with Prisma ORM is now in Preview 🥳 As of this release, you can deploy your apps that are using Prisma ORM to:

- Vercel Edge Functions and Vercel Edge Middleware
- Cloudflare Workers and Cloudflare Pages

In order to deploy to an edge function, you’ll need to use a compatible database driver (along with its [Prisma driver adapter](https://www.prisma.io/docs/orm/overview/databases/database-drivers#driver-adapters)):

- Neon Serverless Driver (for PostgreSQL databases hosted via [Neon](https://neon.tech/))
- PlanetScale Serverless Driver (for MySQL databases hosted via [PlanetScale](https://planetscale.com/))
- `pg` driver (for traditional PostgreSQL databases)
- `libsql/client` driver (for SQLite databases hosted via [Turso](https://turso.tech/))

Check out our [documentation](https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview) to learn how you can deploy an edge function using any combination of supported edge function provider and database.

You can also read more about it in the [announcement blog post](https://pris.ly/b/prisma-edge)!

Performance improvements in nested `create` operations

With Prisma ORM, you can create multiple new records in _nested_ queries, for example:

ts
const user = await prisma.user.update({
where: { id: 9 },
data: {
name: 'Elliott',
posts: {
create: {
data: [{ title: 'My first post' }, { title: 'My second post' }],
},
},
},
})


In previous versions, Prisma ORM would translate this into multiple SQL `INSERT` queries, each requiring its own roundtrip to the database. As of this release, these nested `create` queries are optimized and the `INSERT` queries are sent to the database _in bulk_ in a single roundtrip. These optimizations apply to one-to-many as well as many-to-many relations.

With this change, using the nested `create` option to create multiple records effectively becomes equivalent to using a nested `createMany` operation (except that `createMany` _only_ works with one-to-many relations, whereas `create` works both with one-to-many and many-to-many).

> **Note**: Only the deepest nested operation is optimized. If a user specified `create (1) -> create (2) -> create (3)` in their query, only `create (3)` will be optimized.

Fixes and improvements

Prisma Client

- [Prisma errors when not using the major.minor.patch versioning system](https://github.com/prisma/prisma/issues/7317)
- [mongodb where condition resulted in combined $ne but should not be $eq](https://github.com/prisma/prisma/issues/15175)
- [Node hangs when `console.log(new PrismaClient())`](https://github.com/prisma/prisma/issues/18292)
- [Add wolfy linux to supported OS](https://github.com/prisma/prisma/issues/18329)
- [Support Linux Gentoo](https://github.com/prisma/prisma/issues/18698)
- [Know engines to download for Void Linux](https://github.com/prisma/prisma/issues/20434)
- [Engine does not support Linux distro "openeuler"](https://github.com/prisma/prisma/issues/20937)
- [Prisma Doesn't Recognize Crystal Linux distro](https://github.com/prisma/prisma/issues/21955)
- [Regression: Mapped `enum` throws error (collation `cp1250_czech_cs` or similar)](https://github.com/prisma/prisma/issues/21967)
- [`NOT` condition leaks out of its desired bounds](https://github.com/prisma/prisma/issues/22007)
- [The column does not exist in the current database.](https://github.com/prisma/prisma/issues/22098)
- [Logging `PrismaClient` object is slow](https://github.com/prisma/prisma/issues/22848)
- [Running `prisma generate` on Litespeed Web Server cPanel with ssh](https://github.com/prisma/prisma/issues/22857)
- [Prisma doesn't know which engines to download for the Linux distro "guttaos"](https://github.com/prisma/prisma/issues/23031)
- [Error in driver-adapter-utils with `tsc`: `Cannot find namespace 'debug'.`](https://github.com/prisma/prisma/issues/23091)
- [VS Code debugger freeze from time to time, when Prisma Client is involved](https://github.com/prisma/prisma/issues/23181)
- [`push` method still unimplemented for scalar lists in CockroachDB](https://github.com/prisma/prisma/issues/23183)
- [`Invalid character` error persists on 5.10.1 in Prisma Studio](https://github.com/prisma/prisma/issues/23225)
- [Add "Peppermint OS" to list of supported distros](https://github.com/prisma/prisma/issues/23237)
- [`runtimeDescription` is not defined error](https://github.com/prisma/prisma/issues/23430)

Prisma Migrate

- [Prisma with UOS or Deepin](https://github.com/prisma/prisma/issues/18374)
- [Warning: Linux distro "slackware"](https://github.com/prisma/prisma/issues/18547)
- [Error when run `npx prisma db pull` with DeepinOS 20.9GNU/LInux](https://github.com/prisma/prisma/issues/19157)
- [Add solus to list of known supported distros](https://github.com/prisma/prisma/issues/21493)
- [NixOS not recognised as a Linux distribution](https://github.com/prisma/prisma/issues/22145)
- [Prisma Warning on Ubuntu 20.04](https://github.com/prisma/prisma/issues/22347)
- [Let Prisma detect Artix Linux distro](https://github.com/prisma/prisma/issues/22522)
- [couldn't identify clear-linux-os](https://github.com/prisma/prisma/issues/22539)
- [Prisma doesn't know which engines to download with `Linux Mint`](https://github.com/prisma/prisma/issues/23141)
- [`Error: Invalid character` when `schema.prisma` includes Chinese/Non-ASCII characters in a comment](https://github.com/prisma/prisma/issues/23201)

Prisma Engines

- [[DA] Planetscale engine tests: aggregations](https://github.com/prisma/prisma-engines/issues/4473)
- [[DA] Planetscale engine tests: json filtering](https://github.com/prisma/prisma-engines/issues/4475)
- [[DA] Planetscale engine tests: order and pagination](https://github.com/prisma/prisma-engines/issues/4478)
- [[DA] Planetscale engine tests: oids](https://github.com/prisma/prisma-engines/issues/4479)
- [[DA] Planetscale engine tests: nested_createmany_fail_dups](https://github.com/prisma/prisma-engines/issues/4481)
- [[DA] Planetscale engine tests: create_many_error_dups](https://github.com/prisma/prisma-engines/issues/4484)
- [[DA] Planetscale engine tests: upsert_fails_if_filter_dont_match](https://github.com/prisma/prisma-engines/issues/4486)

5.10.2

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

Fix in Prisma CLI

- [`Invalid character` error persists on 5.10.1 in Prisma Studio](https://github.com/prisma/prisma/issues/23225)

Page 3 of 44

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.