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(D1): numerical filters and aggregations + emulated referential actions #4970

Merged
merged 17 commits into from
Aug 8, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Jul 31, 2024

This PR:

Companion PR: prisma/prisma#24922


This PR also fixes the broken linkage between prisma/prisma-engines and prisma/prisma by ensuring that the DRIVER_ADAPTERS_BRANCH variable is only extracted from actual Git head refs, rather than any merge branch.

This is what allowed tests in this PR to finally succeed:

      - uses: actions/checkout@v4
        with:
          # using head ref rather than merge branch to get original commit message
          ref: ${{ github.event.pull_request.head.sha }}

Thank you @SevInf for https://prisma-company.slack.com/archives/C03R3PJN004/p1722957691404159?thread_ts=1722440855.494109&cid=C03R3PJN004!

@jkomyno jkomyno self-assigned this Jul 31, 2024
@jkomyno jkomyno requested a review from a team as a code owner July 31, 2024 15:45
@jkomyno jkomyno requested review from Weakky and removed request for a team July 31, 2024 15:45
Copy link
Contributor

github-actions bot commented Jul 31, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.052MiB 2.051MiB 626.000B
Postgres (gzip) 817.788KiB 817.380KiB 417.000B
Mysql 2.020MiB 2.020MiB 636.000B
Mysql (gzip) 804.896KiB 804.701KiB 200.000B
Sqlite 1.917MiB 1.917MiB 616.000B
Sqlite (gzip) 764.431KiB 764.363KiB 70.000B

@jkomyno

This comment was marked as outdated.

@jkomyno jkomyno added this to the 5.18.0 milestone Aug 6, 2024
Copy link

codspeed-hq bot commented Aug 7, 2024

CodSpeed Performance Report

Merging #4970 will not alter performance

Comparing integration/fix-d1-int64 (3fe108c) with main (fc5e53a)

Summary

✅ 11 untouched benchmarks

alexolivier referenced this pull request in cerbos/query-plan-adapters Sep 25, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@cerbos/grpc](https://redirect.github.com/cerbos/cerbos-sdk-javascript/tree/main/packages/grpc#readme)
([source](https://redirect.github.com/cerbos/cerbos-sdk-javascript/tree/HEAD/packages/grpc))
| [`0.18.1` ->
`0.18.3`](https://renovatebot.com/diffs/npm/@cerbos%2fgrpc/0.18.1/0.18.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@cerbos%2fgrpc/0.18.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@cerbos%2fgrpc/0.18.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@cerbos%2fgrpc/0.18.1/0.18.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@cerbos%2fgrpc/0.18.1/0.18.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@prisma/client](https://www.prisma.io)
([source](https://redirect.github.com/prisma/prisma/tree/HEAD/packages/client))
| [`5.17.0` ->
`5.20.0`](https://renovatebot.com/diffs/npm/@prisma%2fclient/5.17.0/5.20.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@prisma%2fclient/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@prisma%2fclient/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@prisma%2fclient/5.17.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@prisma%2fclient/5.17.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/jest](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest)
([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest))
| [`29.5.12` ->
`29.5.13`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.12/29.5.13)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2fjest/29.5.13?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2fjest/29.5.13?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2fjest/29.5.12/29.5.13?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2fjest/29.5.12/29.5.13?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/node](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node)
([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node))
| [`20.14.14` ->
`20.16.7`](https://renovatebot.com/diffs/npm/@types%2fnode/20.14.14/20.16.7)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2fnode/20.16.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2fnode/20.16.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2fnode/20.14.14/20.16.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2fnode/20.14.14/20.16.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [mongoose](https://mongoosejs.com)
([source](https://redirect.github.com/Automattic/mongoose)) | [`8.5.2`
-> `8.6.3`](https://renovatebot.com/diffs/npm/mongoose/8.5.2/8.6.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/mongoose/8.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/mongoose/8.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/mongoose/8.5.2/8.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/mongoose/8.5.2/8.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [prisma](https://www.prisma.io)
([source](https://redirect.github.com/prisma/prisma/tree/HEAD/packages/cli))
| [`5.17.0` ->
`5.20.0`](https://renovatebot.com/diffs/npm/prisma/5.17.0/5.20.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/prisma/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/prisma/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/prisma/5.17.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/prisma/5.17.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [ts-jest](https://kulshekhar.github.io/ts-jest)
([source](https://redirect.github.com/kulshekhar/ts-jest)) | [`29.2.4`
-> `29.2.5`](https://renovatebot.com/diffs/npm/ts-jest/29.2.4/29.2.5) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/ts-jest/29.2.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/ts-jest/29.2.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/ts-jest/29.2.4/29.2.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/ts-jest/29.2.4/29.2.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [typescript](https://www.typescriptlang.org/)
([source](https://redirect.github.com/microsoft/TypeScript)) | [`5.5.4`
-> `5.6.2`](https://renovatebot.com/diffs/npm/typescript/5.5.4/5.6.2) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/typescript/5.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/typescript/5.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/typescript/5.5.4/5.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/typescript/5.5.4/5.6.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>cerbos/cerbos-sdk-javascript (@&#8203;cerbos/grpc)</summary>

###
[`v0.18.3`](https://redirect.github.com/cerbos/cerbos-sdk-javascript/blob/HEAD/packages/grpc/CHANGELOG.md#0183---2024-09-23)

[Compare
Source](https://redirect.github.com/cerbos/cerbos-sdk-javascript/compare/@cerbos/[email protected]...@cerbos/[email protected])

##### Changed

- Bump dependency on
\[[@&#8203;bufbuild/protobuf](https://redirect.github.com/bufbuild/protobuf)]
to 2.1.0
([#&#8203;1012](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/1012))

- Bump dependency on
\[[@&#8203;grpc/grpc-js](https://redirect.github.com/grpc/grpc-js)] to
1.11.3
([#&#8203;1000](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/1000),
[#&#8203;1011](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/1011))

###
[`v0.18.2`](https://redirect.github.com/cerbos/cerbos-sdk-javascript/blob/HEAD/packages/grpc/CHANGELOG.md#0182---2024-08-19)

[Compare
Source](https://redirect.github.com/cerbos/cerbos-sdk-javascript/compare/@cerbos/[email protected]...@cerbos/[email protected])

##### Changed

- Replace dependency on \[protobufjs] with
\[[@&#8203;bufbuild/protobuf](https://redirect.github.com/bufbuild/protobuf)]
([#&#8203;990](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/990))

- Bump dependency on
\[[@&#8203;grpc/grpc-js](https://redirect.github.com/grpc/grpc-js)] to
1.11.1
([#&#8203;974](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/974),
[#&#8203;979](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/979),
[#&#8203;981](https://redirect.github.com/cerbos/cerbos-sdk-javascript/pull/981))

</details>

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

###
[`v5.20.0`](https://redirect.github.com/prisma/prisma/releases/tag/5.20.0)

[Compare
Source](https://redirect.github.com/prisma/prisma/compare/5.19.1...5.20.0)

🌟 **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%20@&#8203;prisma%20release%20v5.20.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/5.20.0)
about the release.** 🌟

#### Highlights

##### `strictUndefinedChecks` in Preview

With Prisma ORM 5.20.0, the Preview feature `strictUndefinedChecks` will
disallow any value that is explicitly `undefined` and will be a runtime
error. This change is direct feedback from [this GitHub
issue](https://redirect.github.com/prisma/prisma/issues/20169) and
follows [our latest
proposal](https://redirect.github.com/prisma/prisma/issues/20169#issuecomment-2338360300)
on the same issue.

To demonstrate the change, take the following code snippet:

```tsx
prisma.table.deleteMany({
  where: {
    // If `nullableThing` is nullish, this query will remove all data.
    email: nullableThing?.property,
  }
})
```

In Prisma ORM 5.19.0 and below, this could result in unintended
behavior. In Prisma ORM 5.20.0, if the `strictUndefinedChecks` Preview
feature is enabled, you will get a runtime error instead:

```tsx
Invalid \`prisma.user.findMany()\` invocation in
/client/tests/functional/strictUndefinedChecks/test.ts:0:0
  XX })
  XX 
  XX test('throws on undefined input field', async () => {
→ XX   const result = prisma.user.deleteMany({
         where: {
           email: undefined
                  ~~~~~~~~~
         }
       })
Invalid value for argument \`where\`: explicitly \`undefined\` values are not allowed."
```

We have also introduced the `Prisma.skip` symbol, which will allow you
to get the previous behavior if desired.

```tsx
prisma.table.findMany({
  where: {
    // Use Prisma.skip to skip parts of the query
    email: nullableEmail ?? Prisma.skip
  }
})
```

From Prisma ORM 5.20.0 onward, we recommend enabling
`strictUndefinedChecks`, along with the TypeScript compiler option
`exactOptionalPropertyTypes`, which will help catch cases of undefined
values at compile time. Together, these two changes will help protect
your Prisma queries from potentially destructive behavior.

`strictUndefinedChecks` will be a valid Preview feature for the
remainder of Prisma ORM 5. With our next major version, this behavior
will become the default and the Preview feature will be “graduated” to
Generally Available.

If you have any questions or feedback about `strictUndefinedChecks`,
please ask/comment in our dedicated [Preview feature GitHub
discussion](https://redirect.github.com/prisma/prisma/discussions/25271).

##### `typedSql` bug fix

Thank you to everyone who has tried out our [`typedSql` Preview
feature](https://www.prisma.io/blog/announcing-typedsql-make-your-raw-sql-queries-type-safe-with-prisma-orm)
and [provided
feedback](https://redirect.github.com/prisma/prisma/discussions/25106)!
This release has a quick fix for typescript files generated when Prisma
Schema enums had hyphens.

#### Fixes and improvements

##### Prisma

- [Prisma incorrectly parses CRDB's FK constraint error as `not
available`.](https://redirect.github.com/prisma/prisma/issues/24072)
- [Invalid TypeScript files created by `generate` when typedSql is
enabled and enum contains
hyphens.](https://redirect.github.com/prisma/prisma/issues/25163)
- [`@prisma/internals` didn't list `ts-toolbelt` in
dependencies.](https://redirect.github.com/prisma/prisma/issues/17952)
- [using `$extends` prevents model comments from being passed to
TypeScript](https://redirect.github.com/prisma/prisma/issues/24648)

##### Prisma Engines

- [Planetscale engine tests:
interactive_tx](https://redirect.github.com/prisma/prisma-engines/issues/4469)
- [Fix broken engine size publishing
workflow](https://redirect.github.com/prisma/prisma-engines/issues/4991)

#### Credits

Huge thanks to
[@&#8203;mcuelenaere](https://redirect.github.com/mcuelenaere),
[@&#8203;pagewang0](https://redirect.github.com/pagewang0),
[@&#8203;key-moon](https://redirect.github.com/key-moon),
[@&#8203;pranayat](https://redirect.github.com/pranayat),
[@&#8203;yubrot](https://redirect.github.com/yubrot),
[@&#8203;thijmenjk](https://redirect.github.com/thijmenjk),
[@&#8203;mydea](https://redirect.github.com/mydea),
[@&#8203;HRM](https://redirect.github.com/HRM),
[@&#8203;haaawk](https://redirect.github.com/haaawk),
[@&#8203;baileywickham](https://redirect.github.com/baileywickham),
[@&#8203;brian-dlee](https://redirect.github.com/brian-dlee),
[@&#8203;nickcarnival](https://redirect.github.com/nickcarnival),
[@&#8203;eruditmorina](https://redirect.github.com/eruditmorina),
[@&#8203;nzakas](https://redirect.github.com/nzakas), and
[@&#8203;gutyerrez](https://redirect.github.com/gutyerrez) for helping!

###
[`v5.19.1`](https://redirect.github.com/prisma/prisma/releases/tag/5.19.1)

[Compare
Source](https://redirect.github.com/prisma/prisma/compare/5.19.0...5.19.1)

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

#### What's Changed

We've fixed the following issues:

-
[https://github.com/prisma/prisma/issues/25103](https://redirect.github.com/prisma/prisma/issues/25103)
-
[https://github.com/prisma/prisma/issues/25137](https://redirect.github.com/prisma/prisma/issues/25137)
-
[https://github.com/prisma/prisma/issues/25104](https://redirect.github.com/prisma/prisma/issues/25104)
-
[https://github.com/prisma/prisma/issues/25101](https://redirect.github.com/prisma/prisma/issues/25101)

**Full Changelog**:
prisma/prisma@5.19.0...5.19.x,
prisma/prisma-engines@5.19.0...5.19.x

###
[`v5.19.0`](https://redirect.github.com/prisma/prisma/releases/tag/5.19.0)

[Compare
Source](https://redirect.github.com/prisma/prisma/compare/5.18.0...5.19.0)

Today, we are excited to share the `5.19.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%20@&#8203;prisma%20release%20v5.19.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/5.19.0)
about the release.** 🌟

#### Highlights

##### Introducing TypedSQL

TypedSQL is a brand new way to interact with your database from Prisma
Client. After enabling the `typedSql` Preview feature, you’re able to
write SQL queries in a new `sql` subdirectory of your `prisma`
directory. These queries are then checked by Prisma during using the new
`--sql` flag of `prisma generate` and added to your client for use in
your code.

To get started with TypedSQL:

1. Make sure that you have the latest version of `prisma` and
`@prisma/client` installed:

        npm install -D prisma@latest
        npm install @&#8203;prisma/client@latest

2.  Enable the `typedSql` Preview feature in your Prisma Schema.

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

3.  Create a `sql` subdirectory of your `prisma` directory.

        mkdir -p prisma/sql

4. You can now add `.sql` files to the `sql` directory! Each file can
contain one sql query and the name must be a valid JS identifier. For
this example, say you had the file `getUsersWithPosts.sql` with the
following contents:

    ```sql
    SELECT u.id, u.name, COUNT(p.id) as "postCount"
    FROM "User" u
    LEFT JOIN "Post" p ON u.id = p."authorId"
    GROUP BY u.id, u.name
    ```

5. Import your SQL query into your code with the `@prisma/client/sql`
import:

    ```tsx
       import { PrismaClient } from '@&#8203;prisma/client'
       import { getUsersWithPosts } from '@&#8203;prisma/client/sql'

       const prisma = new PrismaClient()

const usersWithPostCounts = await
prisma.$queryRawTyped(getUsersWithPosts)
       console.log(usersWithPostCounts)
    ```

There’s a lot more to talk about with TypedSQL. We think that the
combination of the high-level Prisma Client API and the low-level
TypedSQL will make for a great developer experience for all of our
users.

To learn more about behind the “why” of TypedSQL [be sure to check out
our announcement blog post](https://pris.ly/typedsql-blog).

For docs, check out our new [TypedSQL
section](https://pris.ly/d/typedsql).

#### Bug fixes

##### Driver adapters and D1

A few issues with our `driverAdapters` Preview feature and Cloudflare D1
support were resolved via
[https://github.com/prisma/prisma-engines/pull/4970](https://redirect.github.com/prisma/prisma-engines/pull/4970)
and
[https://github.com/prisma/prisma/pull/24922](https://redirect.github.com/prisma/prisma/pull/24922)

- Mathematic operations such as `max`, `min`, `eq`, etc in queries when
using Cloudflare D1.
- Resolved issues when comparing `BigInt` IDs when
`relationMode="prisma"` was enabled and Cloudflare D1 was being used.

##### Joins

-
[https://github.com/prisma/prisma/issues/23742](https://redirect.github.com/prisma/prisma/issues/23742)
fixes Prisma Client not supporting deeply nested `some` clauses when the
`relationJoins` Preview feature was enabled.

#### Join us

Looking to make an impact on Prisma in a big way? We're now hiring
engineers for the ORM team!

- [Senior Engineer
(TypeScript)](https://boards.greenhouse.io/prisma/jobs/5350820002): This
person will be primarily working on the TypeScript side and evolving our
Prisma client. Rust knowledge (or desire to learn Rust) is a plus.
- [Senior Engineer
(Rust)](https://boards.greenhouse.io/prisma/jobs/6940273002): This
person will be focused on the `prisma-engines` Rust codebase. TypeScript
knowledge (or, again, a desire to learn) is a plus.

#### Credits

Huge thanks to
[@&#8203;mcuelenaere](https://redirect.github.com/mcuelenaere),
[@&#8203;pagewang0](https://redirect.github.com/pagewang0),
[@&#8203;Druue](https://redirect.github.com/Druue),
[@&#8203;key-moon](https://redirect.github.com/key-moon),
[@&#8203;Jolg42](https://redirect.github.com/Jolg42),
[@&#8203;pranayat](https://redirect.github.com/pranayat),
[@&#8203;ospfranco](https://redirect.github.com/ospfranco),
[@&#8203;yubrot](https://redirect.github.com/yubrot),
[@&#8203;skyzh](https://redirect.github.com/skyzh) for helping!

###
[`v5.18.0`](https://redirect.github.com/prisma/prisma/releases/tag/5.18.0)

[Compare
Source](https://redirect.github.com/prisma/prisma/compare/5.17.0...5.18.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.18.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/5.18.0)
about the release.** 🌟

##### Highlights

##### Native support for UUIDv7

Previous to this release, the Prisma Schema function `uuid()` did not
accept any arguments and created a UUIDv4 ID. While sufficient in many
cases, UUIDv4 has a few drawbacks, namely that it is not temporally
sortable.

UUIDv7 attempts to resolve this issue, making it easy to temporally sort
your database rows by ID!

To support this, we’ve updated the `uuid()` function in Prisma Schema to
accept an optional, integer argument. Right now, the only valid values
are `4` and `7`, with `4` being the default.

```tsx
model User {
  id   String @&#8203;id @&#8203;default(uuid()) // defaults to 4
  name String
}

model User {
  id   String @&#8203;id @&#8203;default(uuid(4)) // same as above, but explicit
  name String
}

model User {
  id   String @&#8203;id @&#8203;default(uuid(7)) // will use UUIDv7 instead of UUIDv4
  name String
}
```

##### Bug squashing

We’ve squashed a number of bugs this release, special thanks to everyone
who helped us! A few select highlights are:

- [SQLite db will now be created and read from the correct location when
using
`prismaSchemaFolder`](https://redirect.github.com/prisma/prisma/issues/24779).
- [Empty `Json[]` fields will now return `[]` instead of `null` when
accessed through a join using the `relationJoins` Preview
feature.](https://redirect.github.com/prisma/prisma/issues/22923)

##### Fixes and improvements

##### Prisma

- [Support UUID
v7](https://redirect.github.com/prisma/prisma/issues/24079)

##### Language tools (e.g. VS Code)

- [Support fetching references for a
model](https://redirect.github.com/prisma/language-tools/issues/982)

##### Credits

Huge thanks to
[@&#8203;mcuelenaere](https://redirect.github.com/mcuelenaere),
[@&#8203;pagewang0](https://redirect.github.com/pagewang0),
[@&#8203;Druue](https://redirect.github.com/Druue),
[@&#8203;key-moon](https://redirect.github.com/key-moon),
[@&#8203;Jolg42](https://redirect.github.com/Jolg42),
[@&#8203;pranayat](https://redirect.github.com/pranayat),
[@&#8203;ospfranco](https://redirect.github.com/ospfranco),
[@&#8203;yubrot](https://redirect.github.com/yubrot),
[@&#8203;skyzh](https://redirect.github.com/skyzh),
[@&#8203;haaawk](https://redirect.github.com/haaawk) for helping!

</details>

<details>
<summary>Automattic/mongoose (mongoose)</summary>

###
[`v8.6.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#863--2024-09-17)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.2...8.6.3)

\==================

- fix: make getters convert uuid to string when calling toObject() and
toJSON()
[#&#8203;14890](https://redirect.github.com/Automattic/mongoose/issues/14890)
[#&#8203;14869](https://redirect.github.com/Automattic/mongoose/issues/14869)
- fix: fix missing Aggregate re-exports for ESM
[#&#8203;14886](https://redirect.github.com/Automattic/mongoose/issues/14886)
[wongsean](https://redirect.github.com/wongsean)
- types(document): add generic param to depopulate() to allow updating
properties
[#&#8203;14891](https://redirect.github.com/Automattic/mongoose/issues/14891)
[#&#8203;14876](https://redirect.github.com/Automattic/mongoose/issues/14876)

###
[`v8.6.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#862--2024-09-11)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.1...8.6.2)

\==================

- fix: make set merge deeply nested objects
[#&#8203;14870](https://redirect.github.com/Automattic/mongoose/issues/14870)
[#&#8203;14861](https://redirect.github.com/Automattic/mongoose/issues/14861)
[ianHeydoc](https://redirect.github.com/ianHeydoc)
- types: allow arbitrary keys in query filters again (revert
[#&#8203;14764](https://redirect.github.com/Automattic/mongoose/issues/14764))
[#&#8203;14874](https://redirect.github.com/Automattic/mongoose/issues/14874)
[#&#8203;14863](https://redirect.github.com/Automattic/mongoose/issues/14863)
[#&#8203;14862](https://redirect.github.com/Automattic/mongoose/issues/14862)
[#&#8203;14842](https://redirect.github.com/Automattic/mongoose/issues/14842)
- types: make SchemaType static setters property accessible in
TypeScript
[#&#8203;14881](https://redirect.github.com/Automattic/mongoose/issues/14881)
[#&#8203;14879](https://redirect.github.com/Automattic/mongoose/issues/14879)
- type(inferrawdoctype): infer Date types as JS dates rather than
Mongoose SchemaType Date
[#&#8203;14882](https://redirect.github.com/Automattic/mongoose/issues/14882)
[#&#8203;14839](https://redirect.github.com/Automattic/mongoose/issues/14839)

###
[`v8.6.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#861--2024-09-03)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.0...8.6.1)

\==================

- fix(document): avoid unnecessary clone() in applyGetters() that was
preventing getters from running on 3-level deep subdocuments
[#&#8203;14844](https://redirect.github.com/Automattic/mongoose/issues/14844)
[#&#8203;14840](https://redirect.github.com/Automattic/mongoose/issues/14840)
[#&#8203;14835](https://redirect.github.com/Automattic/mongoose/issues/14835)
- fix(model): throw error if bulkSave() did not insert or update any
documents
[#&#8203;14837](https://redirect.github.com/Automattic/mongoose/issues/14837)
[#&#8203;14763](https://redirect.github.com/Automattic/mongoose/issues/14763)
- fix(cursor): throw error in ChangeStream constructor if
changeStreamThunk() throws a sync error
[#&#8203;14846](https://redirect.github.com/Automattic/mongoose/issues/14846)
- types(query): add $expr to RootQuerySelector
[#&#8203;14845](https://redirect.github.com/Automattic/mongoose/issues/14845)
- docs: update populate.md to fix missing match: { }
[#&#8203;14847](https://redirect.github.com/Automattic/mongoose/issues/14847)
[makhoulshbeeb](https://redirect.github.com/makhoulshbeeb)

###
[`v8.6.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#860--2024-08-28)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.5...8.6.0)

\==================

- feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor
in Mongoose with `MongooseError` instead of `MongoCursorExhaustedError`
[#&#8203;14813](https://redirect.github.com/Automattic/mongoose/issues/14813)
- feat(model+query): support options parameter for distinct()
[#&#8203;14772](https://redirect.github.com/Automattic/mongoose/issues/14772)
[#&#8203;8006](https://redirect.github.com/Automattic/mongoose/issues/8006)
- feat(QueryCursor): add getDriverCursor() function that returns the raw
driver cursor
[#&#8203;14745](https://redirect.github.com/Automattic/mongoose/issues/14745)
- types: change query selector to disallow unknown top-level keys by
default
[#&#8203;14764](https://redirect.github.com/Automattic/mongoose/issues/14764)
[alex-statsig](https://redirect.github.com/alex-statsig)
- types: make toObject() and toJSON() not generic by default to avoid
type widening
[#&#8203;14819](https://redirect.github.com/Automattic/mongoose/issues/14819)
[#&#8203;12883](https://redirect.github.com/Automattic/mongoose/issues/12883)
- types: avoid automatically inferring lean result type when assigning
to explicitly typed variable
[#&#8203;14734](https://redirect.github.com/Automattic/mongoose/issues/14734)

###
[`v8.5.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#855--2024-08-28)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.4...8.5.5)

\==================

- fix(populate): fix a couple of other places where Mongoose gets the
document's \_id with getters
[#&#8203;14833](https://redirect.github.com/Automattic/mongoose/issues/14833)
[#&#8203;14827](https://redirect.github.com/Automattic/mongoose/issues/14827)
[#&#8203;14759](https://redirect.github.com/Automattic/mongoose/issues/14759)
- fix(discriminator): shallow clone Schema.prototype.obj before merging
schemas to avoid modifying original obj
[#&#8203;14821](https://redirect.github.com/Automattic/mongoose/issues/14821)
- types: fix schema type based on timestamps schema options value
[#&#8203;14829](https://redirect.github.com/Automattic/mongoose/issues/14829)
[#&#8203;14825](https://redirect.github.com/Automattic/mongoose/issues/14825)
[ark23CIS](https://redirect.github.com/ark23CIS)

###
[`v8.5.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#854--2024-08-23)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.3...8.5.4)

\==================

- fix: add empty string check for collection name passed
[#&#8203;14806](https://redirect.github.com/Automattic/mongoose/issues/14806)
[Shubham2552](https://redirect.github.com/Shubham2552)
- docs(model): add 'throw' as valid strict value for bulkWrite() and add
some more clarification on throwOnValidationError
[#&#8203;14809](https://redirect.github.com/Automattic/mongoose/issues/14809)

###
[`v8.5.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#853--2024-08-13)

[Compare
Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.2...8.5.3)

\==================

- fix(document): call required functions on subdocuments underneath
nested paths with correct context
[#&#8203;14801](https://redirect.github.com/Automattic/mongoose/issues/14801)
[#&#8203;14788](https://redirect.github.com/Automattic/mongoose/issues/14788)
- fix(populate): avoid throwing error when no result and `lean()` set
[#&#8203;14799](https://redirect.github.com/Automattic/mongoose/issues/14799)
[#&#8203;14794](https://redirect.github.com/Automattic/mongoose/issues/14794)
[#&#8203;14759](https://redirect.github.com/Automattic/mongoose/issues/14759)
[MohOraby](https://redirect.github.com/MohOraby)
- fix(document): apply virtuals to subdocuments if parent schema has
virtuals: true for backwards compatibility
[#&#8203;14774](https://redirect.github.com/Automattic/mongoose/issues/14774)
[#&#8203;14771](https://redirect.github.com/Automattic/mongoose/issues/14771)
[#&#8203;14623](https://redirect.github.com/Automattic/mongoose/issues/14623)
[#&#8203;14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- types: make HydratedSingleSubdocument and HydratedArraySubdocument
merge types instead of using &
[#&#8203;14800](https://redirect.github.com/Automattic/mongoose/issues/14800)
[#&#8203;14793](https://redirect.github.com/Automattic/mongoose/issues/14793)
- types: support schema type inference based on schema options
timestamps as well
[#&#8203;14773](https://redirect.github.com/Automattic/mongoose/issues/14773)
[#&#8203;13215](https://redirect.github.com/Automattic/mongoose/issues/13215)
[ark23CIS](https://redirect.github.com/ark23CIS)
- types(cursor): indicate that cursor.next() can return null
[#&#8203;14798](https://redirect.github.com/Automattic/mongoose/issues/14798)
[#&#8203;14787](https://redirect.github.com/Automattic/mongoose/issues/14787)
- types: allow mongoose.connection.db to be undefined
[#&#8203;14797](https://redirect.github.com/Automattic/mongoose/issues/14797)
[#&#8203;14789](https://redirect.github.com/Automattic/mongoose/issues/14789)
- docs: add schema type widening advice
[#&#8203;14790](https://redirect.github.com/Automattic/mongoose/issues/14790)
[JstnMcBrd](https://redirect.github.com/JstnMcBrd)

</details>

<details>
<summary>kulshekhar/ts-jest (ts-jest)</summary>

###
[`v29.2.5`](https://redirect.github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2925-2024-08-23)

[Compare
Source](https://redirect.github.com/kulshekhar/ts-jest/compare/v29.2.4...v29.2.5)

</details>

<details>
<summary>microsoft/TypeScript (typescript)</summary>

###
[`v5.6.2`](https://redirect.github.com/microsoft/TypeScript/compare/v5.5.4...a7e3374f13327483fbe94e32806d65785b0b6cda)

[Compare
Source](https://redirect.github.com/microsoft/TypeScript/compare/v5.5.4...v5.6.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - "after 9am and before 5pm Monday" (UTC).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/cerbos/query-plan-adapters).

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

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants