Skip to content
On this page

@history

History tables and change-tracking triggers for update/delete workflows

Postgres Mysql (beta) Sqlite (beta) Mssql

Example

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:

NameTypeRequiredValues
destinationstringNo
onarrayNoupdate, delete

Lint Rules

history.require-history

Tables should have a @history tag

Default severity: warn