Releases: adonisjs/lucid
Support for libSQL and new health checks
This release adds first-class support for libSQL and removes all options + types + methods related to legacy way of doing health checks. Instead, you must use the following two classes to register health checks with AdonisJS v6.
import db from '@adonisjs/lucid/services/db'
import { DbConnectionCountCheck, DbCheck } from '@adonisjs/lucid/database'
new HealthChecks().register([
new DbCheck(db.connection()),
new DbConnectionCountCheck(db.connection())
])
Breaking changes
- The
config.healthCheck
property - Remove
connection.getReport
method. - Remove
connectionManager.report
method. - Remove
ReportNode
type.
Deprecations
- Deprecate
connection.dialectName
in favor ofconnection.clientName
. TheclientName
refers to the npm clients you can use with Knex anddialectName
refers to the Lucid dialects. One dialect can be used with multiple clients. For example, the MySQL dialect can be used withmysql
andmysql2
clients.
Commits
- test: another attempt at fixing broken tests 8a4df1c
- test: fix breaking tests 2d9697b
- refactor: update usages of dialectName with clientName 7fedbfe
- feat: add support for libsql and cleanup clients to dialects mapping 95f11d1
- feat: export health check classes 1b32dca
- feat: add database health checks and remove legacy health check flag 0373e7f
- refactor: remove legacy health checks 32f377e
- test: fix broken types 44da18c
- chore: update peer dependencies 9dbd7fc
- chore: update dependencies bdc32b5
Full Changelog: v20.6.0...v21.0.0
Improvements to the DateTime comparison when using "orCreate" methods
In this release, we improve the comparison logic used by firstOrCreate
, firstOrNew
, and updateOrCreate
methods to properly compare Luxon DateTime instances when finding or persisting a new row.
Commits
- Merge pull request #991 from adamcikado/develop 94b666a
- fix: compare DateTime in newUpIfMissing 669bdb3
- Merge pull request #1017 from adamcikado/feat/exports 92ed475
- fix: some typos (#1024) ba5961b
- chore: update postgresql version 7315d0e
- chore: update version & add cross-env 52906a5
- Merge pull request #1023 from MaximeMRF/fix/step-option-migrator b084678
- fix(migrator): step option 781c479
- feat: add missing exports 5d87cf8
What's Changed
- fix(migrator): step option by @MaximeMRF in #1023
- fix some typos by @TiBianMod in #1024
- feat: add missing exports by @adamcikado in #1017
- fix: compare DateTime in newUpIfMissing by @adamcikado in #991
New Contributors
- @TiBianMod made their first contribution in #1024
- @adamcikado made their first contribution in #1017
Full Changelog: v20.5.1...v20.6.0
Add clause variant to findBy method
Latest 20.5.0
was missing some commits.
This release is published only as a patch since 20.5.0
was released a few minutes ago.
Add step option to the migrator
What's Changed
- fix: omit double quotes from connection name by @pokedpeter in #983
- feat(base_model): add findManyBy method by @RomainLanz in #1010
- feat(Migrator): add step option by @MaximeMRF in #1013
Full Changelog: v20.3.1...v20.5.0
Add support for pretty printing debug queries and findMany helper method
Related documentation for few features
- https://lucid.adonisjs.com/docs/debugging#pretty-printing-debug-queries
- https://lucid.adonisjs.com/docs/crud-operations#findmanyby
Commits
- chore(release): 20.3.1 8e1f3a7
- style: remove unused imports f989fb6
- feat: add support for pretty print debug queries f3976b9
- Merge pull request #1010 from adonisjs/feat/findMany 4427c8d
- style: lint e0a2b03
- fix(base_model): execute the query in findManyBy deb0052
- feat(base_model): add findManyBy method ea41f57
- fix: omit double quotes from connection name (#983) 8c333e0
- chore: fix url in readme 67ba462
- fix(configure): correct call to logger.error 2754e5c
What's Changed
- fix: omit double quotes from connection name by @pokedpeter in #983
- feat(base_model): add findManyBy method by @RomainLanz in #1010
Full Changelog: v20.3.0...v20.4.0
Correct call to logger.error when configuring the package
- fix(configure): correct call to logger.error 2754e5c
Bug fixes and new API on BaseModel
This release fixes the dropAllTables
implementation for SQLite so that we can drop tables even when unsafe mode is disabled.
Also, a new model method lockForUpdate
has been added. This method refetches the model instance from the database and locks the row for update. This allows you to perform updates without running into race-conditions. For example:
// Assuming you already have a model instance.
const user = auth.user.lockForUpdate((newUser) => {
// newUser is a fresh model instance and now row is locked inside the database
newUser.email = newEmail
await newUser.save()
return newUser
})
Commits
- test: reset tables between tests 1b47ba7
- feat: add model.lockForUpdate method to lock the model row for updates 703e6b5
- chore(package): update dependencies 018c4ce
- refactor: change sqlite dropAllTables implementation (#1001) 5c18c76
What's Changed
- refactor: change sqlite dropAllTables implementation by @Julien-R44 in #1001
Full Changelog: v20.2.0...v20.3.0
Add `exists` and `unique` bindings to `VineNumber` & drop postgres domain
What's Changed
- fix(vinejs): add
exists
andunique
bindings toVineNumber
by @Tahul in #998 - Update database_provider.ts by @amir-mohammad-HP in #1002
- feat: drop postgres domain by @MaximeMRF in #981
New Contributors
- @Tahul made their first contribution in #998
- @amir-mohammad-HP made their first contribution in #1002
Full Changelog: v20.1.0...v20.2.0
Add DatabaseTestUtils
This release adds the DatabaseTestUtils class, which includes some helpers for writing tests that interacts your database, such as migration/seeding/truncating and global transactions to keep a clean state between each test.
See full documentation here : https://docs.adonisjs.com/guides/database-tests
Commits
Full Changelog: v20.0.0...v20.1.0
Switch default naming strategy to camelCase and add support for nulls treatment in order by clause
Breaking change
- In this release we switch the naming strategy of the ORM and the Paginator to return camelCase output for the serialized object keys. This should have made its way in the last release, but somehow missed it. You can switch back to SnakeCase strategy by explicitly assigning it to the BaseModel. https://lucid.adonisjs.com/docs/model-naming-strategy
Switching back to snake_case
naming strategy
If you like to keep using the old snake case naming strategy, then you can copy-paste the following code inside a service provider of your application.
import { SnakeCaseNamingStrategy } from '@adonisjs/lucid/orm'
import { BaseModel } from '@adonisjs/lucid/orm'
export default class AppProvider {
async boot() {
BaseModel.namingStrategy = new SnakeCaseNamingStrategy()
}
}
New features
Add support for defining treatment of null values in orderBy
method. For example:
orderBy([
{ column: 'expires_at', order: 'desc', nulls: 'last' },
{ column: 'last_used_at', order: 'desc', nulls: 'first' }
])
The above method calls will add compile to ORDER BY expires_at desc NULLS LAST
and ORDER BY last_used_at desc NULLS FIRST
sql statements
Commits
- feat: add support for nulls property for orderby method signature b4af593
- chore(package): update dependencies 4777edc
- chore: remove
@types/pluralize
from dependencies cee062c - Merge pull request #986 from adonisjs/feat/serialize_to_camelcase d33b9b1
- refactor: use camelCase naming strategy with paginator also 7e35cc2
- fix: remove unused imports d327871
- feat: change naming strategy to output camelCase key names in serialized output c835376
- chore: update dependencies 718c68f
- fix(seeds): correct log for ignored seed 71708b8
What's Changed
- Breaking change - Switch ORM naming strategy to CamelCase by @thetutlage in #986
- chore: remove
@types/pluralize
from dependencies by @targos in #987
Full Changelog: v19.0.0...v20.0.0