by kuon · 2y ago · 0 comments
For example, is my app, we decided that versions would represent "committed" modifications, for example you can modify a chapter title 60 times and then publish and get only one version. For "undo" we use browser storage. We came to this solution because it is a shared collaborative editor. In the end it is very git inspired.
The other big "problem" is structure. There are things that should and should not be versionned.
My point is that a usefull version system is very tightly coupled with the business logic, and it is not just snapshot.
We ended up doing it all in typescript, or with some postgraphile shenanigans.
One of the things we missed when requirements gathering was the ability to view a table of records each at their "latest published" version.
I think this can probably be done by including a pair of tztsrange columns in the history table (one for "when was this the latest valid draft?" and one for "when was this the latest valid published version", and do a bunch of date shuffling whenever you publish a version.
We've not actually done this yet, because there are some edge cases around dependency graphs and computed columns, but for a simpler app I reckon it would work just fine.
(Besides, the business versioning doesn't even have to be a single one, or have a single active version at each time.)
Those extensions are often sufficient for the change log (if you add extra information on your tables). But then, they are way overkill for that.