ReviewOS

also looking at this

stacks/bun-query-builder

docs(delete): describe soft deletes as the builder implements them

#1162
Merged glennmichael123 wants to merge docs/delete-soft-deletes into main
1 file +32 -19
9 days ago

Problem

The soft-deletes section of docs/delete.md documented three things the query builder doesn't do:

DocumentedActual
Enable with softDeletes: true on a model entryNothing reads that. The builder's filter comes from setConfig({ softDeletes: { enabled, column, defaultFilter } }); models use traits: { useSoftDeletes: true }
db.remove('users', 1) soft-deletes, "sets deleted_at = NOW()"It's a real DELETE. The Force Delete section a few lines later says so
db.deleteFrom('users').onlyTrashed().forceDelete().execute()Neither method exists on deleteFrom(); the call throws

Change

  • The section now says the builder only filters marked rows, and shows the config that turns the filter on.
  • Marking a row goes through updateTable().set({ deleted_at }). The model-layer calls that mark instead of removing are linked from here.
  • Force delete now shows deleteFrom().whereNotNull('deleted_at') and User.onlyTrashed().delete() (the purge from #1111).

Every snippet in the rewritten sections was executed against SQLite, including withTrashed()/onlyTrashed(), both restore paths, and db.remove() removing the row. Docs lint passes (7/7).

Found along the way, not fixed here

docs-lint's "only documents builder methods that exist" rule checks only db.method( calls on a single line, so a method on a continuation line ( .forceDelete()) is never checked. That's how this example got through. Extending the rule to continuation lines turns up 22 more hits across the docs: .whereMonth(), .whereJson(), .forUpdate(), .increment() on updateTable(), and others. Some may be methods the check can't see, so that needs its own pass.

🤖 Generated with Claude Code

1 changed file on the files tab, with 0 review threads.

Sign in to comment on this pull request.