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(client): safe and unsafe raw queries #8728
Conversation
BREAKING CHANGE
packages/client/src/__tests__/integration/errors/executeRaw-alter-postgres/test.ts
Show resolved
Hide resolved
…isma/prisma into break/safe-unsafe-raw-queries
There was a problem hiding this comment.
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?
@Jolg42 the current changes are TS-only changes, we'd like to add an error for JS users too (runtime). |
Tracked in #8808 now |
packages/client/src/__tests__/integration/happy/blog-env-mssql/test.ts
Outdated
Show resolved
Hide resolved
packages/client/src/__tests__/integration/happy/blog-env-mssql/test.ts
Outdated
Show resolved
Hide resolved
packages/client/src/__tests__/integration/happy/blog-env-mssql/test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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)
...
...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice documentation! 💚
Fixes #7142
Fixes #8189
Fixes #8808
BREAKING CHANGE