@temporal
Temporal namespace plugin -- generates SCD Type 2 temporal tables. Adds valid_from/valid_to columns to the table, creates a current-rows view, and generates triggers for versioned row management: - INSERT: set valid_from=NOW(), valid_to=NULL - UPDATE: copy OLD row with valid_to=NOW(), set NEW.valid_from=NOW() - DELETE: archive the row (insert copy with valid_to=NOW()), then allow the delete to proceed Postgres: PL/pgSQL BEFORE trigger functions. MySQL: Limited support — DDL + view + INSERT trigger only (self-referential triggers not supported).
Postgres Mysql (beta)Tags
@temporal
Make this table temporal with valid_from/valid_to versioning (SCD Type 2)
Targets: table
Arguments:
| Name | Type | Required | Values |
|---|---|---|---|
| view | string | No | — |
Lint Rules
temporal.require-temporal
Tables should have a @temporal tag
Default severity: warn