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 tomigration:rollback --batch=0.migration:refresh: Same as callingmigration:resetandmigration:runtogether. 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 callingdb:wipeandmigration:runtogether. 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,
isMainandisInteractive. You can use these properties to change the output behavior of the command.- For example: In the
migration:runcommand we close the database connection only whenisMainis set to true. - Similarly, the
isInteractivecan 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.
- For example: In the
- Now, we load the ace providers all the time
. Earlier, we only loaded the ace providers in the
consoleenvironment. 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
sqlite3driver with@vscode/sqlite3. - Changed data structure from
RETURNINGoperation to be consistent withSELECT. Thereturningmethod 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
testsobject in the.adonisrc.jsonfile. 7e1f22aa1 - Fix drive local drivers to handle special chars 108579cad .
- Allow
forceContentNegotiationto 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-Controlproperty to drive-s3 payload. 1974f933f . - Add support for multipart file uploads 44db02fee .
- Add missing
expiresInproperty to drive-s3 payload. 8be08ae12 . - Add
sumDistinctin 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/fakeras a drop-in replacement forfaker759f2e460 .