fix(engine): Add cast from boolean to integer

- In Postgres you need to cast a boolean to integer to compare boolean
  with integer (0 or 1).