Repository navigation
2.0.0-next.25
Pre-release
Pre-release
What's Changed
Fix query delete behavior when no rows match
QueryBuilder.delete() no longer throws when a constrained delete finds no matching row. It now returns null, which fixes cases like User.query().whereNot({ id: demoUser.id }).delete() behaving as an unexpected failure instead of a no-op.
Add explicit throwing delete variant
Added QueryBuilder.deleteOrFail() for callers that need the previous fail-fast behavior. This preserves a strict path for workflows that expect a deleted model instance or an error.
Keep model instance deletes strict
Model.delete() and Model.forceDelete() now delegate to deleteOrFail(), so deleting a concrete model instance still throws if the underlying row cannot be found. The nullable behavior is limited to query-builder deletes.
Add regression coverage
Added base and Postgres query-builder tests covering:
- non-unique constrained deletes that match no rows now returning
null - row-count stability when the delete is a no-op
deleteOrFail()continuing to throwRecord not found for delete operation.
Full Changelog: 2.0.0-next.23...2.0.0-next.25