title: Nodejs Objection.js conditional patch
body: <p>I need to run a patch (or an update) in Objection.js, based on a condition. I have this code:</p>
  
  <pre><code>if (leavenMachine.ping == true){
     MachinesInit.query()
                  .patch({status: 'OK', online:"yes"})
                  .where('machine', 'leaven machine')
                  .where('type', 'M');
  }else {
    MachinesInit.query()
                  .patch({status: 'OK'})
                  .where('machine', 'leaven machine')
                  .where('type', 'M');
  }
  </code></pre>
  
  <p>I need to refactor it so that I don't need two queries (one inside the if condition and the second inside the else), but just one, embedding the condition inside the patch method. Is it possible? How can I do?</p>