Closed almightyju closed 7 years ago
Yup, will fix this behavior
Fixed in 4.0. You can pass the trx
object to the save
, create
, attach
methods manually now.
@thetutlage in case i have the following code, how do I make it part of a transaction? It's not very clear in the docs when saving relations...
await match.players().save(user)
I tried:
await match.players().save(user, tx)
But doesn't seem to work.
I have the same problem Tried different ways
const partner = await Partner.create(data, tx);
await client.partners().save(partner, tx);
or
const partner = await client.partners().create(data, tx);
or
const partner = await Partner.create(data, tx);
await client.partners().attach([partner.id], null, tx);
This problem still exists.
When I create an account, a group and a user there's no easy way to add it as a transaction
The only one I found to do that was:
await Partner.query()
.where(user_id, 1)
.transacting(transaction)
.update({name : 'john'})
Any answer to this?
Its 2024 and still broken?
I tried to use some code similar to this:
but it hangs on the attach. Folling the code through its becase in Lucid/Relations/BelongsToMany.js attach runs this code:
which doesn't have any transaction logic, it would be nice if I could run this code: