Skip to content

Expand support for update metadata and tracking old values #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: update-metadata
Choose a base branch
from

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.)

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