{"id":13877784,"url":"https://github.com/pgMemento/pgMemento","last_synced_at":"2025-07-16T13:32:43.766Z","repository":{"id":1778538,"uuid":"27195841","full_name":"pgMemento/pgMemento","owner":"pgMemento","description":"Audit trail with schema versioning for PostgreSQL using transaction-based logging","archived":false,"fork":false,"pushed_at":"2023-09-29T23:53:44.000Z","size":8349,"stargazers_count":384,"open_issues_count":9,"forks_count":41,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-11-15T08:47:38.828Z","etag":null,"topics":["audit-trail","jsonb","plpgsql","postgresql","transaction-log","versioning"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgMemento.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-26T20:56:07.000Z","updated_at":"2024-11-14T13:10:00.000Z","dependencies_parsed_at":"2024-06-19T02:49:28.921Z","dependency_job_id":"1f95bdcf-e58d-4da5-aef1-ce4ddb0db5a9","html_url":"https://github.com/pgMemento/pgMemento","commit_stats":{"total_commits":474,"total_committers":12,"mean_commits":39.5,"dds":"0.14135021097046419","last_synced_commit":"33c98951f04b3a03d8fd97ba7311d68e23ae3e66"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgMemento%2FpgMemento","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgMemento%2FpgMemento/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgMemento%2FpgMemento/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgMemento%2FpgMemento/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgMemento","download_url":"https://codeload.github.com/pgMemento/pgMemento/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225709924,"owners_count":17511930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit-trail","jsonb","plpgsql","postgresql","transaction-log","versioning"],"created_at":"2024-08-06T08:01:24.100Z","updated_at":"2024-11-24T06:31:29.848Z","avatar_url":"https://github.com/pgMemento.png","language":"PLpgSQL","funding_links":[],"categories":["PLpgSQL","Compiled list","Extensions"],"sub_categories":["plv8:"],"readme":"# pgMemento\n\n![Tests](https://github.com/pgMemento/pgMemento/workflows/pgmemento-tests/badge.svg)\n\n![alt text](https://github.com/pgMemento/pgMemento/blob/master/material/pgmemento_logo.png \"pgMemento Logo\")\n\npgMemento provides an audit trail for your data inside a PostgreSQL\ndatabase using triggers and server-side functions written in PL/pgSQL.\nIt also tracks DDL changes to enable schema versioning and offers\npowerful algorithms to restore or repair past revisions.\n\nOnly deltas of changes are logged and they are stored in one data log\ntable as JSONB. Transaction and table event metadata is recorded in\nseparate log tables making it easier to browse through past write\noperations.\n\n## Quickstart\n\nTo use pgMemento as an extension download the pgmemento-\u003crelease-version\u003e.zip\narchive either from the release on [GitHub](https://github.com/pgMemento/pgMemento/releases)\nor [PGXN](https://pgxn.org/dist/pgmemento/), change to extracted folder\nand run the following commands from within a shell environment:\n\n```bash\nmake\nsudo make install\n```\n\nThen, connect to your database where you want to use auditing and run:\n\n```sql\nCREATE EXTENSION pgmemento;\n```\n\nAlternatively, you can also add pgMemento to your database the classic\nway by running the INSTALL_PGMEMENTO.sql script, which simply executes\nall SQL files in the right order and updates the search path.\n\n```sql\npsql -h localhost -p 5432 -U my_user -d my_database -f INSTALL_PGMEMENTO.sql\n```\n\nAll of pgMemento's log tables and functions are created in a separate\ndatabase schema called `pgmemento`. Auditing can be started per schema\nwith the `init` command, e.g. for the `public` schema it could be:\n\n```sql\nSELECT pgmemento.init('public');\n```\n\nA new column `pgmemento_audit_id` is added to every table in the given\nschema to trace different row versions in the central data log - the\n`pgmemento.row_log` table. Each write transaction is also logged in the\n`pgmemento.transaction_log` which can consist of multiple table events\nstored in the `pgmemento.table_event_log` table. The `event_key` column\nin the latter links to the entries in the data log.\n\nSchema versioning takes place in the `pgmemento.audit_table_log` and\n`pgmemento.audit_column_log`. Transaction ranges show the life time of\nan audited table and its columns. Changing the table schema, e.g.\naltering data types or dropping entire columns will produce data logs as\nwell. Auditing can also be started automatically for newly created\ntables in schemas where pgMemento has been initialized. This is tracked\n(and configurable) in the `pgmemento.audit_schema_log`.\n\n## System requirements\n\n* PostgreSQL 9.5+\n* PL/pgSQL language\n\n## Documentation\n\nDocumentation can be found in the [wiki](https://github.com/pgMemento/pgMemento/wiki/Home) section of this repository.\n\n## License\n\nThe scripts for pgMemento are open source under GNU Lesser General\nPublic License Version 3.0. See the file LICENSE for more details.\n\n## Disclaimer\n\npgMemento IS PROVIDED \"AS IS\" AND \"WITH ALL FAULTS.\"\nI MAKE NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE\nQUALITY, SAFETY OR SUITABILITY OF THE SKRIPTS, EITHER EXPRESSED OR\nIMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n\nIN NO EVENT WILL I BE LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL,\nINCIDENTAL OR CONSEQUENTIAL DAMAGES HOWEVER THEY MAY ARISE AND EVEN IF\nI HAVE BEEN PREVIOUSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\nSTILL, I WOULD FEEL SORRY.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpgMemento%2FpgMemento","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FpgMemento%2FpgMemento","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpgMemento%2FpgMemento/lists"}