Workflow publish history preserved on version pruning
Publish history entries now survive version cleanup — the timeline stays complete when old versions are pruned, fixing a data loss issue that left gaps in audit records.
When workflow versions were pruned, the corresponding publish history entries were deleted too. This CASCADE behavior meant timelines showed gaps — entries vanished when the versions they referenced were removed. Publish history entries are now preserved when versions are deleted. The versionId field becomes null rather than triggering deletion, keeping the timeline intact. This matters for anyone relying on workflow history for auditing, debugging, or understanding how automations evolved over time. The change applies to the workflow history subsystem in the database layer.
View Original GitHub Description
Summary
Stop deleting the entries on version pruning - we want to show these in a timeline and old entries missing makes this less reliable.
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/ADO-5003
Review / Merge checklist
- I have seen this code, I have run this code, and I take responsibility for this code.
- PR title and summary are descriptive. (conventions) <!-- **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** -->
- Docs updated or follow-up ticket created.
- Tests included. <!-- A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. -->
- PR Labeled with
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)