I have two table dues and souvenirs haveing a similar column std_id. I want to update both of them using transaction but my code returns 1.
db.transaction((trx) => {
return db("dues")
.where({ std_id: stdid })
.update({
level_100: level100,
level_200: level200,
level_300: level300,
level_400: level400,
})
.then(() => {
return db("souvenirs")
.where({
std_id: stdid,
})
.update({
t_shirt: tshirt,
books: books,
});
})
.then((row) => console.log(row))
.then(trx.commit)
.catch((err) => console.log(err));
});