Answers for "knex.raw in migrations file"

0

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`
Posted by: Guest on June-16-2021

Browse Popular Code Answers by Language