i am trying to update a set of data using Sequelize by this query
Users.update({
flag: 'flag & ~ 2'
} , {
where : {
id :{
gt : 2
}
}
})
the generated query is
UPDATE `users` SET `flag`='flag & ~ 2' WHERE id > 2
But is should be
UPDATE `users` SET `flag`=flag & ~ 2 WHERE id > 2
so my question is how can i update data by by it's old value
Regards
You should be able to do this via:
Users.update({
flag: sequelize.literal('flag & ~ 2')
} , {
where : {
id :{
gt : 2
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With