Replies: 2 comments 2 replies
-
await Database.from('user_assets')
.where('coin_id', asset.coin_id)
.where('user_id', asset.user_id)
.update({
qty: qty,
freeze: 'freeze - ' + qty,
}) Update takes a key/value object pair, so there's no need to transform it to raw SQL yourself unless you're doing something more advanced. The key is the db property and the value is the value you want to update that property with. |
Beta Was this translation helpful? Give feedback.
2 replies
-
@thetutlage Why doesn't the lucid model support atomic incr/decr operations? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Quickly two questions here
increment/decrement helper methods only on
@ioc:Adonis/Lucid/Database
but why not in the Model ORM?How to update a Model ORM/Database with a SQL statement
Example:
Getting errors like this
If putting the string type statement, it will not be extractable as the same
Any idea can resolve this issue using ORM/Database instance?
Beta Was this translation helpful? Give feedback.
All reactions