n8n/docs/generated
Arvin Ansari 573cd33fdd
feat(core): Add the activity event table and its migrations (no-changelog)
Append-only record of what recently happened on an instance: an
`ActivityEvent` entity, the `activity_event` table, and a repository with
the single write path plus the two retention deletes.

Nothing reads or writes the table yet, so this ships and rolls back
independently of any behaviour change.

It lives in core `@n8n/db` rather than a module: a record of what changed
on the instance is not specific to one consumer, and scoping it to one
would make every later reader either cross a module boundary or build a
second log.

Three decisions worth keeping:

- `resourceId` has no foreign key. An entry has to outlive what it
  describes — a workflow deletion is the entry most worth keeping, and a
  cascade erases it exactly when it becomes interesting.
- No CHECK on `category` or `action`. A feed covers more kinds with every
  feature, and each widening is another SQLite table recreation. The
  single writer is a typed relay, so the compiler already rejects a value
  outside the union.
- Two indexes on creation, `(projectId, id)` and `(userId, id)`, each
  justified by a read and a foreign key. The per-resource index lands in
  its own migration.

Index assertions read the index DDL back rather than going through
`getTable()`, which returns index columns alphabetically on Postgres and
so would confirm a column order it never checked.
2026-09-01 18:35:50 +02:00
..
postgres-schema feat(core): Add the activity event table and its migrations (no-changelog) 2026-09-01 18:35:50 +02:00
sqlite-schema feat(core): Add the activity event table and its migrations (no-changelog) 2026-09-01 18:35:50 +02:00