AdonisJS v6 is here. Learn more in our release blog post.

March release - 2022

This release ships with long-awaited Lucid commands, improvements to the Ace CLI to allow running commands programmatically, and bug fixes.

You must update all the packages under @adonisjs scope to their latest version. For this, either you can run the npm update command or use the following command to upgrade packages manually.

npx npm-check-updates -i

New Lucid commands

Julien Ripouteau has contributed the long-awaited migration commands. Following are the new commands.

  • migration:reset: Rollback migrations all the way. This command is similar to migration:rollback --batch=0.
  • migration:refresh: Same as calling migration:reset and migration:run together. Optionally, you can also seed the database.
  • db:wipe: This command deletes all the tables in the database. Optionally, you can also drop views and custom PostgreSQL types. Do note this command does not roll back any migrations. Instead, it just wipes the entire database.
  • migration:fresh: Same as calling db:wipe and migration:run together. Optionally, you can also seed the database.

Ace CLI improvements

When working on the new Lucid commands, we realized that we wanted to execute many commands programmatically, leading to the following improvements in the Ace CLI.

  • Within the Ace command, you can access two new properties, isMain and isInteractive. You can use these properties to change the output behavior of the command.
    • For example: In the migration:run command we close the database connection only when isMain is set to true.
    • Similarly, the isInteractive can be used to show prompts only when the command line is interactive. The value is false when commands are running in a CI/CD pipeline.
  • Now, we load the ace providers all the time . Earlier, we only loaded the ace providers in the console environment. The change is required to make ace commands available during testing as well.
  • Add mockConsoleOutput method to the Ace kernel. It is added to test the ace commands easily by collecting all the log messages within memory.

Breaking changes

Lucid has been updated to use the latest version of knex (i.e. 1.x.x). The major release of knex contains the following breaking changes.

  • Replaced unsupported sqlite3 driver with @vscode/sqlite3.
  • Changed data structure from RETURNING operation to be consistent with SELECT. The returning method now returns an array of objects vs. an array of literal values when only one column is selected.

Other improvements and bug fixes

  • Add support for tests object in the .adonisrc.json file. 7e1f22aa1
  • Fix drive local drivers to handle special chars 108579cad .
  • Allow forceContentNegotiation to be a function 73f4c6fb3 .
  • Fix route uuid method validation to follow RFC spec 310f926d5 .
  • Add support for defining lua commands 2ddc05456 .
  • Add bitfield to redis cdb287439 .
  • Gracefully close application when ace exits c5eea6f0d .
  • Add missing Cache-Control property to drive-s3 payload. 1974f933f .
  • Add support for multipart file uploads 44db02fee .
  • Add missing expiresIn property to drive-s3 payload. 8be08ae12 .
  • Add sumDistinct in QueryBuilder 3026bb163 .
  • Allow where and having column names to be a raw query 781add754 .
  • Repl helper to load factories 7e88ad6a8 .
  • Add getAllViews, getAllTypes, dropAllTypes, dropAllTypes, f7aa5b97b .
  • Use @faker-js/faker as a drop-in replacement for faker 759f2e460 .