Is there a way to fire up a raw query/insert/update with a transaction?
I cant find something in the docs whether here nor at the knex docs.
Thanks in advance!
Depending on how you use transactions, any of these should work:
await transaction(Person, async (Person) => {
await Person.raw('select * from foo');
});
await transaction(Person, async (Person, trx) => {
await trx.raw('select * from foo');
});
await transaction(Person.knex(), async (trx) => {
await trx.raw('select * from foo');
});
It's documented here that the transaction object can be used as a knex instance.
Most helpful comment
Depending on how you use transactions, any of these should work:
It's documented here that the transaction object can be used as a knex instance.