AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
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.
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.5.1...v20.6.0
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.
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.3.1...v20.5.0
Related documentation for few features
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.3.0...v20.4.0
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
})
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.2.0...v20.3.0
exists
and unique
bindings to VineNumber
by @Tahul in https://github.com/adonisjs/lucid/pull/998
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.1.0...v20.2.0
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
Full Changelog: https://github.com/adonisjs/lucid/compare/v20.0.0...v20.1.0
snake_case
naming strategyIf 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()
}
}
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
@types/pluralize
from dependencies cee062c@types/pluralize
from dependencies by @targos in https://github.com/adonisjs/lucid/pull/987
Full Changelog: https://github.com/adonisjs/lucid/compare/v19.0.0...v20.0.0
Please consult the following releases to learn more about the breaking changes.
Full Changelog: https://github.com/adonisjs/lucid/compare/v18.4.1...v19.0.0