π§ Nestjs + Prisma, transaction propagation & test rollback & multi-tenancy
Β· 4 min read
Prisma interactive transactionβ
Prisma
is great. Yet it's support for interactive transaction
is currently limited (Up to v5+),
// interactive transaction
prisma.$transaction([array_of_operations,]);
prisma.$transaction(async (tx) => {
// dependent operations
});
Container managed transactionsβ
As we integrate Prisma to NestJs
, we want cross Services
transaction propagation, container managed tx
is even better. After some investigation, we come to @nestjs-cls/transactional,