Prisma supports two approaches to database transactions. The first uses `$transaction` with an array of operations executed atomically — ideal for bulk inserts of unrelated entities. The second, interactive transactions, passes an async callback to `$transaction`, allowing sequential operations where results from one query can be used in the next. If any operation fails or an exception is thrown, the entire transaction rolls back. The interactive transactions feature became production-ready in Prisma 4.7.0, removing the need for the `previewFeatures` flag.

3m read timeFrom playfulprogramming.com
Post cover image

Sort: