Contents
The pgmemento.row_log
table is the most important log table in pgMemento, because it stores the historic data a.k.a the audit trail. It only consists of four columns:
* id BIGSERIAL
: The Primary Key
* audit_id BIGINT NOT NULL
: The implicit link to a table's row
* event_key TEXT
: Concatenated metadata of table event to join with table_event_log
table
* old_data JSONB
: The old values of changed columns in a JSONB object
* new_data JSONB
: The old values of changed columns in a JSONB object
The row_log
is filled by AFTER table triggers or some event triggers e.g. in case of ALTER COLUMN or DROP COLUMN events. The audit_id
column creates the link to each row of audited tables. It's the tracer of the audit trail.
The event_key
column stores the transaction and statement unix timestamp as well as the internal txid, the event type, the table name and schema name. Thus, row logs can be referenced with a table event and corresponding transaction. The temporal part of the key also allows for partitioning the row_log
table.