Estoy tratando de usar una transacción usando el siguiente código (como se indica en los documentos ):
router.patch('/:locationId(\\d+)', asyncWrap(async (req, res, next) => { const { locationId } = req.params const locations = await Locations.transaction(knex, async trx => { // ERROR! const locations = await Locations .query(trx) .patch(req.body) .findById(locationId) .returning('*') return locations }) return res.json(locations) }))Pero me sale el siguiente error:
(knexOrTrx || this.knex(...)).transaction is not a function