prisma
prisma copied to clipboard
Does `upsert` cannot work in `$transaction`
Bug description
Does upsert
cannot work in $transaction
? as it returns Prisma.Prisma__DataClient<Data>
instead of PrismaPromise
.
I tried to use upsert
in transaction, but the executed upsert
before error didn't roll back.
it doesn't work in $transaction([])
, but it works well in interactive transaction $transaction(prisma => {})
.
the data doesn't roll back.
await prisma.$transaction([
prisma.data.update({ where: { id }, data }),
prisma.$executeRaw`TRUNCATE TABLE Words`, // non exisiting table to force throw error
])
the data rolled back
await prisma.$transaction(async prisma => {
await prisma.data.update({ where: { id }, data })
await prisma.$executeRaw`TRUNCATE TABLE Words` // non exisiting table to force throw error
})
How to reproduce
as above.
Expected behavior
No response
Prisma information
as above.
Environment & setup
- OS: Windows 11, Ubuntu 22.4
- Database: Mysql 8
- Node.js version: 18.6
Prisma Version
prisma : 4.1.1
@prisma/client : 4.1.1
Current platform : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Migration Engine : migration-engine-cli 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
Introspection Engine : introspection-core 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
Format Binary : prisma-fmt 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
Default Engines Hash : 8d8414deb360336e4698a65aa45a1fbaf1ce13d8
Studio : 0.469.0
Preview Features : interactiveTransactions