Skip to content

fix(client): safe and unsafe raw queries - #8728

Merged
Jolg42 merged 29 commits into
mainfrom
break/safe-unsafe-raw-queries
Sep 7, 2021
Merged

Jolg42 merged 29 commits into
mainfrom
break/safe-unsafe-raw-queries

Conversation

@millsp

@millsp millsp commented Aug 13, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #7142
Fixes #8189
Fixes #8808

BREAKING CHANGE

@millsp
millsp marked this pull request as ready for review August 14, 2021 01:07
@millsp
millsp requested a review from williamluke4 as a code owner August 14, 2021 01:07
@millsp millsp added this to the 2.31.0 / 3.0.x milestone Aug 14, 2021
Jolg42
Jolg42 approved these changes Aug 18, 2021 •

@Jolg42 Jolg42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! (didn't review everything in detail yet though)

See comment

and what's the state of

TODO:

    add runtime checks (exceptions)

Do not merge now I guess, only for next release?

@millsp

millsp commented Aug 18, 2021

Copy link
Copy Markdown
Contributor Author

@Jolg42 the current changes are TS-only changes, we'd like to add an error for JS users too (runtime).

@janpio

janpio commented Aug 19, 2021

Copy link
Copy Markdown
Contributor

Tracked in #8808 now

@Jolg42 Jolg42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Added a few comments

And need to check the failing tests

FAIL src/__tests__/integration/happy/raw-transactions/test.ts (5.761 s)
  ● transaction › queryRaw

    All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.

      977 |           !p?.isExecuteRaw
      978 |         ) {
    > 979 |           throw new Error(
          |                 ^
      980 |             `All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.`,
      981 |           )
      982 |         }

      at PrismaClient.$___transactionInternal (src/runtime/getPrismaClient.ts:979:17)
      at PrismaClient.$___transaction (src/runtime/getPrismaClient.ts:1015:21)
      at PrismaClient.$transaction (src/runtime/getPrismaClient.ts:1031:21)
      at Object.<anonymous> (src/__tests__/integration/happy/raw-transactions/test.ts:21:30)
...
...

@Jolg42 Jolg42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-approval, for the small changes in progress

@Jolg42 Jolg42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice documentation! 💚

@Jolg42 Jolg42 changed the title fix(client)!: safe and unsafe raw queries fix(client): safe and unsafe raw queries Sep 7, 2021
@Jolg42
Jolg42 merged commit 822198e into main Sep 7, 2021
@Jolg42
Jolg42 deleted the break/safe-unsafe-raw-queries branch September 7, 2021 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants