Using DatabaseTransactions does not play well with app transactions #22


#1

Are there any updates on this issue?

const globalTrx = Database.connection('mysql')._globalTrx
const trx =  globalTrx ? globalTrx : await Database.beginTransaction()

// Do your stuff....
const article = await Article.create(metadata, trx)
await article.translations().create(translation, trx)

if (!globalTrx) {
  trx.commit()
}

This solution doesn’t work when you should rollback the transaction in the code. And test check’s that no new records are created.