Skip to content

audit_log

File: schema/mixins/audit_log.yaml

Attaches the audit_diff trigger to a table. Tables that include this mixin get full field-level change history written to the audit_log table.

ParameterDefaultPurpose
actor_gucapp.actor_idGUC audit_diff reads the actor id from
  • 20_audit_log_diff (AFTER INSERT/UPDATE/DELETE) — writes field-level change history. See audit_diff.

Runs AFTER audit_stamp (20_ > 10_), so created_* / updated_* are already populated when audit_diff fires.

OperationRows written to audit_log
INSERTone __row__: created marker
UPDATEone row per changed column (skipping stamp columns), plus a __row__: archived / restored marker on deleted_at transitions
DELETEone __row__: hard-deleted marker

Include alongside the audit mixin, and ship the audit_log table (this package) as the write target:

mixins: [audit, audit_log]