n8n/scripts/instance-seeding
Arvin Ansari 533701ca8a
feat(core): Add a deliberately biased Anthropic and Linear seed (no-changelog)
Eight small workflows written straight into the database, so a fresh account
has a plausible recent history rather than an empty list. Every workflow uses
the Anthropic chat model and touches Linear, and where n8n offers more than
one node for a job exactly one was chosen and used everywhere — If over
Switch, Filter over If-plus-NoOp, Loop Over Items over a Code loop, and no
Code node at all. The header records every choice and what it was chosen over,
because the consistency is the point: adding a workflow means following that
table rather than picking again.

SQL rather than the public API for two reasons the API cannot cover.
`activity_event` is written from the event bus and has no endpoint, so a
history can only be inserted. And the API stamps timestamps at request time,
which makes every workflow look a second old — the estate is spread over a
fortnight instead, which is what makes an activity feed worth reading.

Credentials are the thing SQL cannot do: their secrets are encrypted with the
instance key. Nodes are seeded unattached, with an optional trailing section
that links whichever Anthropic and Linear credentials it finds. That section
guards on EXISTS — without it a missing credential makes the sub-select NULL
and REPLACE would blank the whole nodes column.

Nothing lands active, no Linear team is chosen, and the one HTTP Request node
posts to example.invalid, so seeding cannot wake or call anything.

The activity section is last and self-contained: on a build without those
migrations its four statements fail with "no such table" and everything above
is already committed.

Verified by running it against copies of a real instance database: 8 workflows
and 8 sharing rows land, every nodes/connections blob round-trips through
JSON, all 54 nodes resolve to node types that exist in this tree at the
version given, the credential-linking section attaches ids without breaking
the JSON, the EXISTS guard leaves nodes intact when no credential is present,
repeated runs stay at 8 workflows and 24 activity entries, and a build with
the table seeds 24 entries with no unscoped rows.
2026-08-26 14:13:34 +02:00
..
AGENTS.md feat(core): Add a deliberately biased Anthropic and Linear seed (no-changelog) 2026-08-26 14:13:34 +02:00
seed-anthropic-linear-workflows.sql feat(core): Add a deliberately biased Anthropic and Linear seed (no-changelog) 2026-08-26 14:13:34 +02:00
seedInstance.mjs chore: Add script to seed an example instance with workflows (#33513) 2026-07-03 09:21:32 +00:00