Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update increment is not possible via update() #8

Open
fulopattila122 opened this issue Feb 21, 2013 · 0 comments
Open

Update increment is not possible via update() #8

fulopattila122 opened this issue Feb 21, 2013 · 0 comments

Comments

@fulopattila122
Copy link

I'm trying to run the following query:

 var newData = {stock: 'stock + 1'};
 db.where({id: data.id}).update('products', newData, ...

The generated sql is

UPDATE `products` SET `stock`='stock+1' WHERE `id`=1

which - due to the single quotation around stock+1 - will result in a 0 stock value.
As a workaround I can still run the query directly, however it'd be nice to have this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant