Skip to content

Add built-in soft delete support - #340

Merged
elpete merged 3 commits into
nextfrom
feat/54-soft-deletes
Aug 28, 2026
Merged

Add built-in soft delete support#340
elpete merged 3 commits into
nextfrom
feat/54-soft-deletes

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #54

Issue review

Recommendation: 9/10 — implement. Soft deletes are common enough that every application should not have to rebuild the same global scope and lifecycle methods. A metadata-driven implementation fits Quick’s entity model. The tradeoffs are an additional nullable timestamp column, behavior changes for delete/deleteAll on opted-in entities, and the need to choose permanent deletion explicitly.

Implementation

Configure an entity with softDeletes=true, optionally set softDeleteColumn (default deletedAt), and define that property. The feature adds:

  • default exclusion of soft-deleted rows
  • withTrashed() and onlyTrashed() query controls
  • entity delete(), restore(), trashed(), and forceDelete() behavior
  • bulk deleteAll(), restoreAll(), and forceDeleteAll() behavior
  • validation that the configured soft-delete attribute exists
  • preserved pre/post delete events for normal and soft deletes

Test-first evidence

The end-to-end public regression initially failed because delete() permanently removed the entity and marked it unloaded. It now covers default visibility, querying trashed rows, restoring, soft bulk deletion/restoration, and permanent entity/bulk deletion.

The first full suite exposed two missing post-delete event assertions after the delete refactor; those were fixed before opening this PR.

Validation

  • focused soft-delete and delete-event specs: 5 passed, 0 failed, 0 errors
  • full Lucee 6 suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check

Uses qb@14.0.0-beta.3.

@elpete
elpete force-pushed the feat/54-soft-deletes branch 3 times, most recently from f2bb980 to 314de60 Compare August 26, 2026 15:12
@elpete
elpete force-pushed the feat/54-soft-deletes branch from ecfcd82 to 5909ba0 Compare August 28, 2026 19:53
@elpete
elpete merged commit 10989a0 into next Aug 28, 2026
1 of 27 checks passed
@elpete
elpete deleted the feat/54-soft-deletes branch August 28, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant