09. November 2021
sumDistinct, where and have raw query
sumDistinct() and raw knex raw queries
@adonisjs/[email protected] and @adonisjs/[email protected] were released adding some new features and bugfixes
sumDistinct()
was added to Lucid query builder. It’s used to sum up all distinct values
db.from('users').sumDistinct('products')
// Generates
// SELECT SUM(DISTINCT products) FROM users
Bugfix in node ace make:model
. Now when make:model
is asked to create migration file too it all runs in same process.
So it can be ensured that migration file was made into correct folder
Raw queries used in query builder can now also be underlying Knex raw queries (knex.raw()
, knex.whereRaw()
etc).
Before they were limited to only AdonisJS raw queries
It adds some additional flexibility when need to use underlying Knex raw()
User.query().where(Database.knexRawQuery('knex raw query'))