prisma/prisma (@prisma/client)
### [`v5.13.0`](https://togithub.com/prisma/prisma/releases/tag/5.13.0)
[Compare Source](https://togithub.com/prisma/prisma/compare/5.12.1...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://togithub.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
},
},
},
})
```
Expand to view the example Prisma schema
```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
}
```
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://togithub.com/prisma/prisma/issues/5042).
**📣 Share your feedback:** [`omitApi` Preview feature](https://togithub.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://togithub.com/prisma/prisma/issues/15174)
##### Prisma Client
- [`✘ [ERROR] near "��": syntax error at offset 0` when running `wrangler d1 migrations apply` with Prisma generated migration (on Windows, using Powershell)](https://togithub.com/prisma/prisma/issues/23702)
##### Credits
Huge thanks to [@ospfranco](https://togithub.com/ospfranco), [@pranayat](https://togithub.com/pranayat), [@yubrot](https://togithub.com/yubrot), [@skyzh](https://togithub.com/skyzh), [@anuraaga](https://togithub.com/anuraaga), [@yehonatanz](https://togithub.com/yehonatanz), [@arthurfiorette](https://togithub.com/arthurfiorette), [@elithrar](https://togithub.com/elithrar), [@tockn](https://togithub.com/tockn), [@Kuhave](https://togithub.com/Kuhave), [@obiwac](https://togithub.com/obiwac) 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 these updates 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:
5.12.1
->5.13.0
5.12.1
->5.13.0
Release Notes
prisma/prisma (@prisma/client)
### [`v5.13.0`](https://togithub.com/prisma/prisma/releases/tag/5.13.0) [Compare Source](https://togithub.com/prisma/prisma/compare/5.12.1...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://togithub.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 }, }, }, }) ```Expand to view the example Prisma schema
```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 } ```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 these updates again.
This PR has been generated by Mend Renovate. View repository job log here.