FG
💻 Software🗄️ DatabasesVercel

API for interactive transactions with dependencies between write-operations

Freshover 4 years ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

There already is a GitHub issue asking for a way to submit multiple mutations within the same HTTP request where all mutations are executed as one transaction. However, this feature does not allow for creating a transaction where the mutations depend on each other. Here is an example where the second operation depends on the first: [code block] This is currently not possible with the Prisma API as it would require having a long-running connection where the results of the operations are sent back and forth between Prisma and the database. It should be considered whether it is helpful to add such an API to Prisma, or whether abstractions like nested mutations and the requested transactional execution of multiple _independent_ transactions are the better approach for Prisma.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
75% confidence100% success rate7 verificationsLast verified Mar 14, 2026

Solution: API for interactive transactions with dependencies between write-operations

Low Risk

👍 This seems like a very useful (if not essential) feature to me and has been the only real pain point for me so far as a new Prisma user. As you've identified, there are situations where you need to perform several mutations in sequence, making use of the response data as you go, but with the confidence that it'll be a single transaction that rolls back in the case of a failure. In my opinion,

75

Trust Score

7 verifications

100% success
  1. 1

    👍 This seems like a very useful (if not essential) feature to me and has been t

    👍 This seems like a very useful (if not essential) feature to me and has been the only real pain point for me so far as a new Prisma user.

  2. 2

    As you've identified, there are situations where you need to perform several mut

    As you've identified, there are situations where you need to perform several mutations in sequence, making use of the response data as you go, but with the confidence that it'll be a single transaction that rolls back in the case of a failure. In my opinion, neither nested mutations or transactions for independent mutations seem quite sufficient for these use-cases.

  3. 3

    If it helps to have example use-cases for discussion, there's a little more deta

    If it helps to have example use-cases for discussion, there's a little more detail about my specific requirement here: https://www.prisma.io/forum/t/transactions-when-the-business-logic-requires-more-than-just-a-nested-insert/5904

Validation

Resolved in prisma/prisma GitHub issue #1844. Community reactions: 34 upvotes.

Verification Summary

Worked: 7
Partial: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

prismaormpostgresqlkind/featuretopic:-prisma-clienttopic:-transaction