Tracking document changes
I'm thinking that storing all changes in a separate table would be the way to go, with an ID field indexed to make searching for changes to a given document more efficient, and the app to use pagination to optimize the query process. The main thing that I'm struggling with is how to identify and collect the change data.
We have dozens of tables, and we'll need this history tracked on each of their documents. I really don't relish the idea of building that many separate history trackers. I'm thinking that some kind of "diff" helper function would be useful. I could pass it any document along with the changes to be saved to that document, and it would return the difference between the two as an object that I could stringify and save to the history table.
Is this doable? If so, I'd love any advice on how to make it work. My grasp of TypeScript is still pretty basic, so I can't quite wrap my head around how I'd approach something like this (if it's even possible with the current Convex design).
