Masayuki Yamaguchi
12/07/2021, 9:09 AMawait prisma.$transaction(async (prisma) => {
const txid1 = await prisma.$queryRawUnsafe('SELECT txid_current()')
console.log('txid1', txid1)
const txid2 = await prisma.$queryRawUnsafe('SELECT txid_current()')
console.log('txid2', txid2)
})
But the following case, both txid1 and txid2 have different value(It means different transaction).
await prisma.$transaction(async (prisma) => {
const txid1 = await prisma.$queryRawUnsafe('SELECT txid_current()')
console.log('txid1', txid1)
const txid2 = await prisma.$queryRawUnsafe('SELECT txid_current()').then() // Code changes
console.log('txid2', txid2)
})
I don’t know why the behavior changes.
Is this a specification?
Is there any way to use “then()” in same transaction?
Thank you.nikolasburk
Masayuki Yamaguchi
12/07/2021, 9:31 AMnikolasburk
Masayuki Yamaguchi
12/08/2021, 2:18 AM