@history
History tables and change-tracking triggers for update/delete workflows
Postgres Mysql (beta) Sqlite (beta) MssqlExample
Track row history
Creates a mirrored history table and before triggers for updates and deletes.
sql
-- @history
CREATE TABLE accounts (
id SERIAL PRIMARY KEY,
email TEXT NOT NULL,
status TEXT NOT NULL
);Tags
@history
Enable history tracking on this table (creates history table + triggers)
Targets: table
Arguments:
| Name | Type | Required | Values |
|---|---|---|---|
| destination | string | No | — |
| on | array | No | update, delete |
Lint Rules
history.require-history
Tables should have a @history tag
Default severity: warn
