kingen ✌🏻
kingen ✌🏻
Explore posts from servers
PPrisma
Created by kingen ✌🏻 on 7/9/2024 in #help-and-questions
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?
1 replies