@audit
Audit log tables and row-change triggers across supported database engines
Postgres Mysql (beta) Sqlite (beta) MssqlExample
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:
| Name | Type | Required | Values |
|---|---|---|---|
| on | array | No | insert, update, delete |
| destination | string | No | — |
@audit.redact
Mark this column for redaction in audit logs
Targets: column
Arguments:
| Name | Type | Required | Values |
|---|---|---|---|
| strategy | enum | Yes | hash, mask, omit |
Lint Rules
audit.require-audit
Tables should have an @audit tag
Default severity: warn
