Skip to content

Releases: adonisjs/lucid

Bug fixes and new API on BaseModel

27 Feb 10:26
Compare
Choose a tag to compare

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

Full Changelog: v20.2.0...v20.3.0

Add `exists` and `unique` bindings to `VineNumber` & drop postgres domain

22 Feb 18:34
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v20.1.0...v20.2.0

Add DatabaseTestUtils

29 Jan 12:03
Compare
Choose a tag to compare

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

  • feat: add DatabaseTestUtils (#988) 9c845f6
  • feat: add @adonisjs/lucid/migration submodule 629ca32

Full Changelog: v20.0.0...v20.1.0

Switch default naming strategy to camelCase and add support for nulls treatment in order by clause

25 Jan 04:39
Compare
Choose a tag to compare

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

Stable major release

11 Jan 02:38
24a14cf
Compare
Choose a tag to compare

Please consult the following releases to learn more about the breaking changes.

Commits

  • chore: publish under latest tag f664a07
  • Merge pull request #982 from adonisjs/v6-next 24a14cf
  • refactor: fix mess created by the merge 57d9ca7
  • Merge branch 'develop' into v6-next 0ee3ee6
  • refactor: export stubsRoot ae090bd
  • chore(package): update dependencies 06422e1
  • feat(QueryBuilder/where): add null type to where clause (#967) 2790fe9
  • fix(migrator): set primary key for schema_versions table (#945) 0fac231
  • Revert "fix(migrator): exception class expect two arguments" 498c308
  • fix(migrator): exception class expect two arguments 947e851
  • fix(migrator): await rollback when changing migration format 19dad5b
  • fix: DateTime equality in $dirty (#929) f72c991
  • fix(configure): change localhost to 127.0.0.1 0417d84
  • chore(release): 18.4.1 14befae
  • test(component): fix references to missing types upon compiling in tests (#951) 62ae085
  • chore: add engines key c5a9f51
  • feat(adonis-typings/relations.ts): typing support for nullable 1-1 relations (hasOne and belongsTo) (#944) b7ec9d4

What's Changed

  • fix: correct path for exporting types by @RomainLanz in #955
  • fix(provider): properly define the adapter for the base model by @RomainLanz in #956
  • fix(configure): add commands to the rc file by @RomainLanz in #954
  • fix(types): allow belongs to and has one to be null by @RomainLanz in #958
  • fix(migrator): set primary key for schema_versions table by @RomainLanz in #957
  • fix(datetime): check equalities properly by @RomainLanz in #959
  • fix: DateTime equality in $dirty by @sadiqueWiseboxs in #929
  • fix(configure): add missing luxon install by @RomainLanz in #964
  • feat(errors): use new way to define exceptions by @RomainLanz in #966
  • fix: correct a typo in the readme by @maevdb in #969
  • fix(migrator): set primary key for schema_versions table by @RomainLanz in #945
  • feat(QueryBuilder/where): add null type to where clause by @MaximeMRF in #967
  • fix: release connection in provider shutdown by @Julien-R44 in #977
  • refactor(orm): use naming strategy for computed field by @RomainLanz in #970
  • Merge to develop for final release by @thetutlage in #982

New Contributors

  • @sadiqueWiseboxs made their first contribution in #929
  • @maevdb made their first contribution in #969
  • @MaximeMRF made their first contribution in #967

Full Changelog: v18.4.1...v19.0.0

Update peer dependencies range

26 Dec 06:30
Compare
Choose a tag to compare
Pre-release
  • chore: update peer dependencies 12a8a90

v19.0.0-7...v19.0.0-8

Use latest API for publishing stubs

26 Dec 06:23
Compare
Choose a tag to compare
Pre-release
  • test: fix breaking tests ae35d24
  • refactor: update stubs to use latest APIs 0556cb5

Full Changelog: v19.0.0-6...v19.0.0-7

All bug fixes

15 Dec 09:25
Compare
Choose a tag to compare
All bug fixes Pre-release
Pre-release
  • test: remove searchPath from postgreSQL config 4b10565
  • refactor: add connectionString config option in postgresql config 2ae295b
  • fix(orm): use naming strategy for computed field (#970) 073fee4
  • fix: mention search paths from config during db:wipe and db:truncate commands 5e99253
  • fix: make models inherit relationships 8a6f894
  • refactor: deprecate useTransaction method usage on query builder 223db39
  • fix: passing connection debug flag to relationships loaded via model instance b44d15e
  • fix: logic for wrapping existing where clauses when applying relationship constraints 45cad2e
  • chore: package update dependencies 638b150
  • fix: release connection in provider shutdown (#977) 8b839d3

What's Changed

Full Changelog: v19.0.0-5...v19.0.0-6

Add unique and exists rules

28 Nov 05:27
Compare
Choose a tag to compare
Pre-release
  • refactor: define vine types within the provider ceec581
  • refactor: do not promopt for db selection when --db flag is used 58244db
  • refactor: create tmp directory during configure for sqlite dialect c952219
  • feat: add unique and exists validation rules ef6fbc3
  • refactor: remove useTz flag from timestamps 0ebd2ee
  • fix: invalid migration alter stub 811e059
  • feat: add type info for db:query event 1e5bab3
  • refactor: do not import env when using sqlite driver 797957d

Full Changelog: v19.0.0-4...v19.0.0-5

Update dependencies

27 Nov 11:03
Compare
Choose a tag to compare
Update dependencies Pre-release
Pre-release

What's Changed

  • fix: correct a typo in the readme by @maevdb in #969

New Contributors

  • @maevdb made their first contribution in #969

Full Changelog: v19.0.0-3...v19.0.0-4