{"repo":"mmkal/plv8-git","free":true,"listed":false,"github":"https://github.com/mmkal/plv8-git","clone":"git clone https://github.com/mmkal/plv8-git.git","description":"Tracks history of rows in postgresql database tables, using git","language":"TypeScript","stars":29,"topics":["plv8","postgres","git","postgresql","versioning","plv8-git"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"plv8-git An experimental helper which tracks the modification history of rows in postgres database tables, using git, based on the idea in this tweet. The implementation uses plv8 to run JavaScript in postgres, with isomorphic-git and memfs to perform git operations in-memory. - Motivation - Usage - Tracking history - Deletions - Options - Commit messages - Git config - Log depth - Tags - Restoring previous versions - Column name clashes - Caveat - Implementation Motivation To paraphrase @mayfer's twitter thread: - never have to worry about building edit/delete/undo/backup/recover type features, one generic git-backed [column] is enough - removes the need to keep additional SQL tables which keep logs of all edit histories. - makes event sourcing a lot more modular. instead of tons of tables storing custom events, every SQL update on a column also updates its git bundle, saved into a separate binary column - with just 1 extra column, you can add multiuser versioning to any indexed column! - how cool this will be for large JSON or other text blob c get overwritten a lot duringall commits are controlled by the main app, it's trivial to integrate commit authors directly into any regular application's user auth system - due to the git standard, this repo then can easily be fed into any generic git UI for all sorts of diffing, logging & visualizing Usage The easiest way to get started is to use the pre-baked sql files exported with the package: Or from javascript: Note: for create ","default_branch":null,"files":null,"tree":[],"storefront":"/r/mmkal","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mmkal/plv8-git/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}