Questions tagged [prisma-transaction]
4 questions
6
votes
2 answers
Transaction function argument type
I want to use $transaction but I don't know what type I should pass to Prisma so that it provides me with type checking and autocompletion for models.
export default async function SignUp(data: SIGNUP_INTERFACE) {
try {
let user = await…

Ankush Verma
- 689
- 1
- 8
- 17
1
vote
2 answers
How to use $transaction API in this scenario?
const a = prisma.user.create()
throw new Error() // some error happened
const b = prisma.user.create()
prisma.$transaction([a, b])
Since an error happened, prisma.$transaction was never called, so a inserted into the database.

刘佳闻
- 43
- 1
- 6
0
votes
0 answers
Is it possible to check if a PrismaClient instance is currently in a transaction?
To do an "interactive" transaction in Prisma, one writes:
prisa.$transaction(async (txnClient) => {
// Write code that uses txnClient just like a non-transactional PrismaClient instance.
Given an instance of PrismaClient, is there a way to test…

okhobb
- 758
- 8
- 22
0
votes
1 answer
Prisma: how to write transaction where results from one query are used by another query
I'm working on a project with Next.js and Prisma. In one of my API routes, I have a three queries. The results of the first and second queries are used in the third query. I'd like to do all three operations as a transaction and then return the data…

Neil Girardi
- 4,533
- 1
- 28
- 45