Note on a breaking change
This release includes a technically breaking change (from this PR) in the behaviour of this call:
await repository.delete({})
Old behaviour was to delete all rows from the table
New behaviour is to throw an error: Empty criteria(s) are not allowed for the delete method.
Why?
The "truncation" behaviour was not documented and is considered dangerous as it can allow a badly-formed object (e.g. with an undefined id) to inadvertently delete the whole table.
The docs on delete()
state:
delete - Deletes entities by entity id, ids or given conditions:
await repository.delete(1)
await repository.delete([1, 2, 3])
await repository.delete({ firstName: "Timber" })
The correct method for deleting all rows (truncating), use:
await repository.clear()
This also has the advantage of using TRUNCATE which is much faster than DELETE.
What's Changed
- chore: Fix publish command by @michaelbromley in #11379
- build(deps): bump tar-fs from 2.1.1 to 2.1.2 by @dependabot in #11370
- feat: add new foreign key decorator, and entity schemas options by @yevhen-komarov in #11144
- chore: fix changelog generation by @alumni in #11381
- feat: Build ESM migrations for JS by @w3nl in #10802
- docs(entity-subscribers): document primary key availability in UpdateEvent by @jovanadjuric in #11308
- test: remove unused type parameter from decorators by @mguida22 in #11412
- feat: Add query timeout support for MySql by @iliagrvch in #10846
- Chore: Added logging to the Entity Listener Metadata by @JackNytely in #11234
- Propagate
aggregate
method's generic parameter to its returned cursor by @pringon in #10754 - refactor: define Position type for GeoJSON objects by @knoid in #11259
- perf(query-runner): use Date.now() intead of +new Date() by @Samuron in #10811
- feat: add FormattedConsoleLogger by @w3nl in #11401
- docs: update repository additional chunk option usage example by @knicefire in #11282
- docs: Correct "its" -> "it's" by @mdippery in #11428
- fix: prevent error when replication is undefined by @caiquecastro in #11423
- fix: change how array columns are compared on column changed detection by @mnbaccari in #11269
- build: setup testing matrix for postgres 14 and 17 by @mguida22 in #11433
- fix: beforeQuery promises not awaited before query execution by @TanguyPoly in #11086
- fix(sap): cleanup after streaming by @alumni in #11399
- feat: release PR releases using pkg.pr.new by @naorpeled in #11434
- docs: clarify where to add new tests by @mguida22 in #11438
- fix: update/delete/softDelete by criteria of condition objects by @maxbronnikov10 in #10910
- chore: Version 0.3.23 by @michaelbromley in #11439
New Contributors
- @yevhen-komarov made their first contribution in #11144
- @w3nl made their first contribution in #10802
- @iliagrvch made their first contribution in #10846
- @JackNytely made their first contribution in #11234
- @pringon made their first contribution in #10754
- @knoid made their first contribution in #11259
- @Samuron made their first contribution in #10811
- @knicefire made their first contribution in #11282
- @caiquecastro made their first contribution in #11423
- @mnbaccari made their first contribution in #11269
- @TanguyPoly made their first contribution in #11086
- @maxbronnikov10 made their first contribution in #10910
Full Changelog: 0.3.22...0.3.23