Lucid 7.5 - 8.0

Table of contents

The release notes contains an aggregated list of chances made between @adonisjs/[email protected] and @adonisjs/[email protected]. You can also check individual releases on Github.

Upgrade using the following command

npm i @adonisjs/[email protected]
yarn add @adonisjs/[email protected]


  • addition: Add pagination support using simple paginator (uses offset based approach). d3584fe

  • addition: Add ref and raw methods to create raw query builder instances that cannot be executed, but used as a reference on existing queries. Check release notes

      Database.raw('count(*) as user_count, status')
  • addition: Add support for global transactions. Helpful when writing tests, since each test can start and rollback a global transaction to always start from a clean state. Check release note

  • addition: Define model hooks using decorators ae2f398

    import Hash from '@ioc:Adonis/Core/Hash'
    import { column, beforeSave, BaseModel } from '@ioc:Adonis/Lucid/Orm'
    export default class User extends BaseModel {
      public password: string
      @beforeSave()  public static async hashPassword (user: User) {    if (user.$dirty.password) {      user.password = await Hash.hash(user.password)    }  }}
  • addition: Add unique and exists validation rules. 4768c3c

  • chore: Run whole test suite on MSSQL as well 5c35853, 6874d59

  • addition: Add support for query scopes. 88cf86b

  • addition: Add onQuery hook property on relationship options. 9b58684

    import { column, hasOne, HasOne, BaseModel } from '@ioc:Adonis/Lucid/Orm'
    export default class User extends BaseModel {
      @hasOne(() => Profile, {
        onQuery: (query) => query.where('is_active', true)
      public profile: HasOne<typeof Profile>
  • addition: Add (before/after)Find and (before/after)Fetch hooks. 5e125f9

  • addition: Implement universal query logger that emits db:query event for all queries. 1466b31

  • addition: Add pretty printer to print SQL queries with colors and context. Goes hand in hand with the db:query event. 4281d1f

  • addition: Add self managed transactions. 0e2f6ee. Read more about it in guides.

On this page

Table of contents