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.
Parameters
Section titled “Parameters”| Parameter | Default | Purpose |
|---|---|---|
actor_guc | app.actor_id | GUC audit_diff reads the actor id from |
Trigger
Section titled “Trigger”20_audit_log_diff(AFTER INSERT/UPDATE/DELETE) — writes field-level change history. Seeaudit_diff.
Runs AFTER audit_stamp (20_ > 10_), so created_* / updated_* are
already populated when audit_diff fires.
What gets written
Section titled “What gets written”| Operation | Rows written to audit_log |
|---|---|
INSERT | one __row__: created marker |
UPDATE | one row per changed column (skipping stamp columns), plus a __row__: archived / restored marker on deleted_at transitions |
DELETE | one __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]