Prisma RLS example makes transactions not possible to use

Hi, The example for how to implement RLS as seen https://www.prisma.io/blog/client-extensions-preview-8t3w27xkrxxn#example-row-level-security
prisma.$extends({
query: {
$allModels: {
async $allOperations({ args, query }) {
const [, result] = await prisma.$transaction([
prisma.$executeRaw`SELECT set_config('app.bypass_rls', 'on', TRUE)`,
query(args),
]);
return result;
},
},
},
})
prisma.$extends({
query: {
$allModels: {
async $allOperations({ args, query }) {
const [, result] = await prisma.$transaction([
prisma.$executeRaw`SELECT set_config('app.bypass_rls', 'on', TRUE)`,
query(args),
]);
return result;
},
},
},
})
If all queries are being wrapped inside a transaction, does that mean I can not use transactions within my application as that would nest transactions? Is it possible to get a reference to an ongoing transaction inside of your extension?
Prisma
Prisma Client Just Became a Lot More Flexible: Prisma Client Extens...
Learn how Prisma Client extensions (Preview) enable a variety of new use cases for the Prisma ORM.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server