Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update prisma monorepo to v5.2.0 #9064

Merged
merged 2 commits into from
Aug 30, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 25, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@prisma/client (source) 5.1.1 -> 5.2.0 age adoption passing confidence
@prisma/internals (source) 5.1.1 -> 5.2.0 age adoption passing confidence
prisma (source) 5.1.1 -> 5.2.0 age adoption passing confidence

Release Notes

prisma/prisma (@​prisma/client)

v5.2.0

Compare Source

🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟

Highlights

Improved Prisma Client experience for Prisma Accelerate and Data Proxy

In this release, we’ve made the following improvements to Prisma Client when using Prisma Accelerate or Prisma Data Proxy:

  • Prisma Client will now automatically determine how it should connect to the database depending on the protocol in the connection string. If the connection string starts with prisma://, Prisma Client will try to connect to your database using Prisma Accelerate or Prisma Data Proxy.

  • Prisma Studio now works with Prisma Data Proxy and Prisma Accelerate.

  • We’ve introduced a new --no-engine flag which will prevent a Query Engine file from being included in the generated Prisma Client. This flag will also help ensure the bundle size of your application remains small by excluding the Query Engine files from the generated Prisma Client.

    prisma generate --no-engine

    The --data-proxy and --accelerate flags have not been removed but are now aliases for the new --no-engine flag.

    We recommend using the --no-engine flag when generating Prisma Client that uses either Accelerate or Data Proxy.

Simplified connection string override in Prisma Client

This release simplifies the API used when programmatically overriding the connection string by introducing the datasourceUrl property in Prisma Client’s constructor. This means you do not have to use the datasource name defined in your Prisma schema.

const prisma = new PrismaClient({
  datasourceUrl: "postgresql://johndoe:randompassword@localhost:5432/mydb",
})

Query performance improvements

Continuing our work from 5.1.0 we made further performance improvements around the queries Prisma executes, targeting one-to-many relation fields and nested updates.

Use LIMIT in one-to-many relations on a single parent

In cases where there is a single parent with a one-to-many relation included (findFirst, findUnique, findMany({ take: 1 })), we now utilize LIMIT at the database level to restrict the number of related items returned instead of retrieving all related items into memory and performing a take in memory.

For situations where you have many related objects but only need a few, you should see a dramatic improvement in speed and memory usage.

Note: we are still working on bringing this improvement to other parts of Prisma Client in upcoming releases. If multiple parent records are returned, the previous behavior is used.

Further improvements for nested writes

Thanks to our introduction of using RETURNING in some cases in 5.1.0, we could now improve performance in nested writes by removing reload nodes. This will now result in one less query per relation traversed in a nested write. For more info, check out the pull request.

Prisma Client query
await prisma.post.update({
  where: { id: 1 },
  data: {
    comment: {
      update: { 
        data: {
          body: "Updated comment body"
        }
      }
    }
  },
  select: {
    id: true,
    title: true,
  }
})
Before v5.2.0
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Post"."id", "Post"."userId" FROM "Post" WHERE "Post"."id" = $1 OFFSET $2
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id", "User"."commentId" FROM "User" WHERE "User"."id" = $1 OFFSET $2
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3
5.2.0 and later
SELECT "Post"."id", "Post"."title", "Post"."userId" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id", "User"."commentId" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3

Fixes and improvements

Prisma Client
Prisma Migrate

Credits

Huge thanks to @​skyzh, @​alula, @​michaelpoellath, @​RobertCraigie, @​darthmaim, @​Gerschtli, @​andyjy, @​mejiaej, @​iurylippo, @​mrazauskas, @​coder246, @​RDIL for helping!


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

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.

@renovate renovate bot enabled auto-merge (squash) August 25, 2023 03:40
@renovate renovate bot force-pushed the renovate/prisma-monorepo branch from 31dfda6 to 7ef2462 Compare August 29, 2023 16:01
@thedavidprice thedavidprice added the release:chore This PR is a chore (means nothing for users) label Aug 30, 2023
@thedavidprice thedavidprice added this to the next-release milestone Aug 30, 2023
@thedavidprice thedavidprice merged commit 3c6b845 into main Aug 30, 2023
3 checks passed
@thedavidprice thedavidprice deleted the renovate/prisma-monorepo branch August 30, 2023 03:37
jtoar pushed a commit that referenced this pull request Sep 2, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@prisma/client](https://www.prisma.io)
([source](https://togithub.com/prisma/prisma)) | [`5.1.1` ->
`5.2.0`](https://renovatebot.com/diffs/npm/@prisma%2fclient/5.1.1/5.2.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@prisma%2fclient/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@prisma%2fclient/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@prisma%2fclient/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@prisma%2fclient/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@prisma/internals](https://www.prisma.io)
([source](https://togithub.com/prisma/prisma)) | [`5.1.1` ->
`5.2.0`](https://renovatebot.com/diffs/npm/@prisma%2finternals/5.1.1/5.2.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@prisma%2finternals/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@prisma%2finternals/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@prisma%2finternals/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@prisma%2finternals/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [prisma](https://www.prisma.io)
([source](https://togithub.com/prisma/prisma)) | [`5.1.1` ->
`5.2.0`](https://renovatebot.com/diffs/npm/prisma/5.1.1/5.2.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/prisma/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/prisma/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/prisma/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/prisma/5.1.1/5.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

<details>
<summary>prisma/prisma (@&#8203;prisma/client)</summary>

[Compare
Source](https://togithub.com/prisma/prisma/compare/5.1.1...5.2.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@&#8203;prisma%20release%20v5.2.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/5.2.0)
about the release.** 🌟

Proxy

In this release, we’ve made the following improvements to Prisma Client
when using [Prisma
Accelerate](https://www.prisma.io/data-platform/accelerate) or [Prisma
Data Proxy](https://www.prisma.io/data-platform/proxy):

- Prisma Client will now automatically determine how it should connect
to the database depending on the protocol in the connection string. If
the connection string starts with `prisma://`, Prisma Client will try to
connect to your database using Prisma Accelerate or Prisma Data Proxy.
- Prisma Studio now works with Prisma Data Proxy and Prisma Accelerate.
- We’ve introduced a new `--no-engine` flag which will prevent a Query
Engine file from being included in the generated Prisma Client. This
flag will also help ensure the bundle size of your application remains
small by excluding the Query Engine files from the generated Prisma
Client.

    ```bash
    prisma generate --no-engine
    ```

The `--data-proxy` and `--accelerate` flags have not been removed but
are now aliases for the new `--no-engine` flag.

We recommend using the `--no-engine` flag when generating Prisma Client
that uses either Accelerate or Data Proxy.

This release simplifies the API used when programmatically overriding
the connection string by introducing the `datasourceUrl` property in
Prisma Client’s constructor. This means you do not have to use the
datasource name defined in your Prisma schema.

```tsx
const prisma = new PrismaClient({
  datasourceUrl: "postgresql://johndoe:randompassword@localhost:5432/mydb",
})
```

Continuing our work from
[5.1.0](https://togithub.com/prisma/prisma/releases/tag/5.1.0) we made
further performance improvements around the queries Prisma executes,
targeting [one-to-many relation
fields](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/one-to-one-relations)
and [nested
updates](https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#update-all-related-records-or-filter).

In cases where there is a single parent with a one-to-many relation
included (`findFirst`, `findUnique`, `findMany({ take: 1 })`), we now
utilize `LIMIT` at the database level to restrict the number of related
items returned instead of retrieving all related items into memory and
performing a `take` in memory.

For situations where you have many related objects but only need a few,
you should see a dramatic improvement in speed and memory usage.

**Note**: we are still working on bringing this improvement to other
parts of Prisma Client in upcoming releases. If multiple parent records
are returned, the previous behavior is used.

Thanks to our introduction of using `RETURNING` in some cases in 5.1.0,
we could now improve performance in nested writes by removing reload
nodes. This will now result in one less query per relation traversed in
a nested write. For more info, [check out the pull
request](https://togithub.com/prisma/prisma-engines/pull/4108).

```tsx
await prisma.post.update({
  where: { id: 1 },
  data: {
    comment: {
      update: {
        data: {
          body: "Updated comment body"
        }
      }
    }
  },
  select: {
    id: true,
    title: true,
  }
})
```

```sql
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Post"."id", "Post"."userId" FROM "Post" WHERE "Post"."id" = $1 OFFSET $2
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id", "User"."commentId" FROM "User" WHERE "User"."id" = $1 OFFSET $2
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3
```

```sql
SELECT "Post"."id", "Post"."title", "Post"."userId" FROM "Post" WHERE ("Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "User"."id" FROM "User" WHERE (1=1 AND "User"."id" IN ($1)) OFFSET $2
SELECT "User"."id", "User"."commentId" FROM "User" WHERE ("User"."id" = $1 AND 1=1) LIMIT $2 OFFSET $3
SELECT "Comment"."id" FROM "Comment" WHERE (1=1 AND "Comment"."id" IN ($1)) OFFSET $2
UPDATE "Comment" SET "body" = $1 WHERE ("Comment"."id" = $2 AND 1=1) RETURNING "Comment"."id"
SELECT "Post"."id", "Post"."title" FROM "Post" WHERE "Post"."id" = $1 LIMIT $2 OFFSET $3
```

- [CFW: Avoid including Query Engine when data proxy is
enabled](https://togithub.com/prisma/prisma/issues/9597)
- [Local Prisma Studio does not work with Data
Proxy](https://togithub.com/prisma/prisma/issues/12734)
- [Postinstall hook always generates non Data Proxy Prisma
Client](https://togithub.com/prisma/prisma/issues/13608)
- [`limit` is gone when `findUnique` with include relation
](https://togithub.com/prisma/prisma/issues/14499)
- [`Cannot fetch data from service: include is not a function` Error
while using Next.js with Data
Proxy](https://togithub.com/prisma/prisma/issues/15395)
- [`take` key doesn't work correctly for nested query that returns one
item with its nested
children](https://togithub.com/prisma/prisma/issues/15623)
- [Prisma Client Edge: environment variables are not working with the
"new" Module Worker syntax for Cloudflare
Workers](https://togithub.com/prisma/prisma/issues/15958)
- [Add documentation to "PrismaClient is unable to be run in the
browser"](https://togithub.com/prisma/prisma/issues/16153)
- [Change how Data Proxy Client deals with unsupported preview
features](https://togithub.com/prisma/prisma/issues/17796)
- [Custom Prisma Client output location breaks Prisma Data Proxy in
NextJS](https://togithub.com/prisma/prisma/issues/18227)
- [GetPayload type error since 4.16.1 "Two different types with this
name exist, but they are
unrelated."](https://togithub.com/prisma/prisma/issues/20422)
- [Browser bundle: Unhandled Runtime Error when upgrading to 5.1.0 from
5.0.0 ](https://togithub.com/prisma/prisma/issues/20480)
- [Prisma Client: `disconnect: true` does not appear to delete the
foreign key in the returned
data](https://togithub.com/prisma/prisma/issues/20491)
- [Prisma Client errors with "TypeError: Cannot create proxy with a
non-object as target or handler" when using result client extension with
no `needs` and `count`
method](https://togithub.com/prisma/prisma/issues/20499)
- [Upgrading from Prisma 5.0.0 -> 5.1.0 results in "TS2321: Excessive
stack depth comparing types" error using
`mockDeep<PrismaClient>()`](https://togithub.com/prisma/prisma/issues/20516)
- [Unnecessary reads for to-one nested
updates](https://togithub.com/prisma/prisma/issues/20556)
- [Better error message if `@prisma/client/edge` can not find
environment variable](https://togithub.com/prisma/prisma/issues/20589)
- [5.1: Alias for old name for `<Model>CountOutputTypeDefaultArgs` does
not exist](https://togithub.com/prisma/prisma/issues/20614)
- [Incorrect pagination for nested m2m chunked
reads](https://togithub.com/prisma/prisma/issues/20624)

- [RustPanic on `prisma generate` when Unsupported field defined in a
Composite type](https://togithub.com/prisma/prisma/issues/19694)
- [Use PostgreSQL System Information Functions instead of manually
joining fields](https://togithub.com/prisma/prisma/issues/19935)
- [Duplicate expression index comment whenever db pull is
run](https://togithub.com/prisma/prisma/issues/20386)

Huge thanks to [@&#8203;skyzh](https://togithub.com/skyzh),
[@&#8203;alula](https://togithub.com/alula),
[@&#8203;michaelpoellath](https://togithub.com/michaelpoellath),
[@&#8203;RobertCraigie](https://togithub.com/RobertCraigie),
[@&#8203;darthmaim](https://togithub.com/darthmaim),
[@&#8203;Gerschtli](https://togithub.com/Gerschtli),
[@&#8203;andyjy](https://togithub.com/andyjy),
[@&#8203;mejiaej](https://togithub.com/mejiaej),
[@&#8203;iurylippo](https://togithub.com/iurylippo),
[@&#8203;mrazauskas](https://togithub.com/mrazauskas),
[@&#8203;coder246](https://togithub.com/coder246),
[@&#8203;RDIL](https://togithub.com/RDIL) for helping!

</details>

---

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/redwoodjs/redwood).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzYuNTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: David Price <thedavid@thedavidprice.com>
@jtoar jtoar modified the milestones: next-release, v6.2.0 Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:chore This PR is a chore (means nothing for users)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants