Thursday, 11 May 2017

How to leverage Adonis / Lucid Query Builder to use MySQL JSON functions?

I would like to use Adonis's ORM Lucid to build queries using MySQL JSON functions to modify JSON values, ex:

UPDATE entities e SET e.config = JSON_SET(e.config, "$.features", JSON_OBJECT("utilities", JSON_OBJECT("water", FALSE, "gas", TRUE, "electric", TRUE))) WHERE e.id = 125009489;

Is there a way write raw MySQL queries when Lucid's native querying methods don't suffice ?



via phizzy

No comments:

Post a Comment