Part of the complete-ORM roadmap. executeInTransaction exists at the executor level, but typed delegates always run on the root executor — multi-step atomic flows (booking: consultation + appointment + slots) force consumers back to JQB inside hand-rolled transactions.
API (Prisma parity)
final result = await prisma.$transaction((tx) async {
final c = await tx.consultation.create(data: ...);
await tx.appointment.create(data: CreateAppointmentInput(consultationId: c.id, ...));
return c;
}, isolationLevel: IsolationLevel.serializable);
Implementation sketch
PrismaClient.$transaction(Future<T> Function(PrismaClient tx) fn, {IsolationLevel?}): start adapter transaction, construct a PrismaClient whose BaseExecutor routes through the transaction connection, commit/rollback on completion/throw.
- Delegates already take an executor in their constructor — generate a
PrismaClient._withExecutor(...) internal constructor.
- Postgres adapter:
BEGIN ISOLATION LEVEL … already supported via startTransaction.
Unlocks the booking-algorithm migration off JQB (Practitionist/familiarise_mobile#106, #113).
Part of the complete-ORM roadmap.
executeInTransactionexists at the executor level, but typed delegates always run on the root executor — multi-step atomic flows (booking: consultation + appointment + slots) force consumers back to JQB inside hand-rolled transactions.API (Prisma parity)
Implementation sketch
PrismaClient.$transaction(Future<T> Function(PrismaClient tx) fn, {IsolationLevel?}): start adapter transaction, construct a PrismaClient whose BaseExecutor routes through the transaction connection, commit/rollback on completion/throw.PrismaClient._withExecutor(...)internal constructor.BEGIN ISOLATION LEVEL …already supported via startTransaction.Unlocks the booking-algorithm migration off JQB (Practitionist/familiarise_mobile#106, #113).