Version history tracking added to n8n

A new version history table records every n8n version upgrade on startup, with REST endpoints to query adoption dates and check continuous version adherence.
n8n now tracks every version an instance has run since it was first deployed. A new database table records version changes automatically each time the platform starts up on the leader instance, storing the major, minor, and patch version number alongside a timestamp.
Developers can query this history through REST endpoints: find when an instance first adopted a specific version, check whether it has been running that version continuously since a given date, or retrieve the minimum version installed since a particular point in time.
This capability addresses a gap in n8n's publish history system. Previously, when a version was deleted from the system, its associated publish history was also removed — making it impossible to distinguish complete histories from partial ones. Now the version timeline provides a reliable record that persists independent of version deletions.
The tracking applies to the main instance type only and includes caching to avoid repeated database queries.
View Original GitHub Description
Summary
Add a new db table which tracks version updates on launch. Exposes some unused functions on the controller - I mostly need getDateSinceContinuouslyAtLeastVersion but I figured the others may demonstrate other useful access patterns.
Not sure if we want any additional data on this, open to suggestions.
Also not sure if the major, minor, patch ints are flexible enough for long term storage, but it lets us avoid parsing and handling edge cases on read. Maybe we should add a affix columns which stores an optional affix parsed from N8N_VERSION?
Concrete use case is https://github.com/n8n-io/n8n/pull/26907, where we previously deleted past publish history entries when the version itself was deleted, and we want to tell apart complete histories from partial ones
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/ADO-5002
Review / Merge checklist
- 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)