3 ms·
Thanks, not sure how I missed this - just added to my “Postgres Is Enough” list: https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f06dbb#audit-logs h
by cpursley 3y ago
Thanks, not sure how I missed this - just added to my “Postgres Is Enough” list:
https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f06dbb#audit-logs https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f...
I do a similar thing but add a foreign key columns for faster lookups (traversing using is slow on large sets when querying). The fk’s get set by the function itself during insert. This allows me to create per resource audit logs in the UI.
I also wrote some deep diff functions to get the changes between the old and new jsonb if anyone is interest. This makes it easy to display what exactly changed.
- kiwicopple 3y ago> deep diff functions to get the changes between the old and new jsonb if anyone is interest I'd love to see this if it's public
- cpursley 3y agoSure. It's somewhat out of date but gets the general idea across: https://gist.github.com/cpursley/a2ae79423bee9274e3639839967e17ff#file-activity_feed_logic-sql-L80 https://gist.github.com/cpursley/a2ae79423bee9274e3639839967...