Skip to content

timestamps

File: schema/mixins/timestamps.yaml

Adds created_at / updated_at and the trigger that maintains them — the actor-free subset of audit. Use on tables that want creation/update times but carry no change-attribution (no created_by / updated_by, so no dependency on an identity table).

No parameters.

ColumnTypeNullNotes
created_attimestamptzNOT NULLstamped on INSERT
updated_attimestamptzNOT NULLrefreshed on every write
  • 10_timestamps_stamp (BEFORE INSERT/UPDATE) — stamps created_at on INSERT and updated_at on every write. See timestamps_stamp.

Maintenance is trigger-based, not column defaults. A BEFORE trigger has to fire anyway to keep updated_at fresh on UPDATE (a DEFAULT only fires on INSERT), so created_at is stamped in the same trigger at no extra cost — and can’t be overridden by a client-supplied value. Both are set to the same CURRENT_TIMESTAMP (transaction start) on INSERT.

# tables that want times but no actor attribution
mixins: [timestamps]

Pair with audit instead when you need actor columns.