4 ms·
With a procedural language and SQL introspection features, you can programmatically generate triggers, functions and backing tables for these kinds of things. F
by solidsnack9000 4y ago
With a procedural language and SQL introspection features, you can programmatically generate triggers, functions and backing tables for these kinds of things. For Postgres, this SQL can generate temporal tables backed by JSONB for any table:
https://github.com/solidsnack/macaroon/blob/master/temporal.sql https://github.com/solidsnack/macaroon/blob/master/temporal....
It would be pretty easy to change this to perform deletion-with-interning like mentioned in the article.
In an older version, the code actually replicated the schema of the source table in the log table; but it can lead to problems during migrations.