Skip to content

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented Apr 9, 2025

This is a follow-up for #60 to:

  • Support tracking old values with include_old for DELETE statements.
  • Support storing old values only if they have changed (through include_old_only_when_changed).
  • Support storing old values only for a subset of column names (by setting include_old to a JSON array string).
  • Support include_metadata for inserts.
  • Support include_metadata for deletes with a special UPDATE <table> SET _deleted = TRUE syntax (we can't attach data to the delete otherwise).

It also refactors some of the implementation details, in particular:

  1. This updates the sqlite-rs version, and then applies our fork that makes ResultCode implement Clone and Copy.
  2. Refactors extracting table options into a typed TableInfo struct.
  3. Moves the logic for creating and iterating over the columns array of a schema table into a shared struct utilizing the streaming_iterator create. This makes it easier to pass custom iterators to json_object_fragment, which is used to restrict include_old to a list of columns.
  4. Simplifies the format! logic to create triggers by using inline references, making it easier to understand. (Eventually, I want to spend some time eventually to that further by e.g. using write!, we're using lots of small allocations and duplicate logic here.)

rkistner
rkistner previously approved these changes Apr 24, 2025
@simolus3 simolus3 changed the base branch from update-metadata to main April 24, 2025 10:51
@simolus3 simolus3 dismissed rkistner’s stale review April 24, 2025 10:51

The base branch was changed.

@simolus3 simolus3 merged commit bf13bc1 into main Apr 24, 2025
21 checks passed
@simolus3 simolus3 deleted the update-options-update branch July 3, 2025 21:01
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.

2 participants