knex.raw in migrations file
knex('users')
.select(knex.raw('count(*) as user_count, status'))
.where(knex.raw(1))
.orWhere(knex.raw('status <> ?', [1]))
.groupBy('status')Outputs:select count(*) as user_count, status from `users` where 1 or status <> 1 group by `status`