Replies: 1 comment 2 replies
-
The computed have nothing to do with the update query or updating columns. I am little bit confused with your question. But anyways, you can use an update request as Networth.query().update({
column1: 'value',
column2: 'value',
column3: 'value'
}) Also, you cannot add a where clause on a column that does exists in the database |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So basically, I have a table that contains a few columns and in a model I have some computed properties.
And a computed property:
Obviously, sumNetworth will sum these values but they will fluctuate every so and then so the table column
value
will have to be updated periodically for all the users. The value column will range fromVery Low
toVery High
. For some reason, I don't want this to be computed property.I was thinking if there is a possibility to update all rows with one query using computed properties (and I really don't want to run a loop). If it's possible to do that with ORM will save me some time otherwise I'd need to opt for raw mysql.
E.g.
Networth.query().where(sumNetworth > 100000).update('Very High')
Beta Was this translation helpful? Give feedback.
All reactions