Skip to content
On this page

@audit

Audit log tables and row-change triggers across supported database engines

Postgres Mysql (beta) Sqlite (beta) Mssql

Example ​

Audit inserts, updates, and deletes ​

Creates an audit table plus triggers that capture row changes.

sql
-- @audit(on: [insert, update, delete])
CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  customer_id INTEGER NOT NULL,
  total NUMERIC(10,2) NOT NULL
);

Tags ​

@audit ​

Enable audit logging on this table

Targets: table

Arguments:

NameTypeRequiredValues
onarrayNoinsert, update, delete
destinationstringNo—

@audit.redact ​

Mark this column for redaction in audit logs

Targets: column

Arguments:

NameTypeRequiredValues
strategyenumYeshash, mask, omit

Lint Rules ​

audit.require-audit ​

Tables should have an @audit tag

Default severity: warn