Moving N8N Instance to new VPS

Hi,

Using N8N 2.1.4 CE and backup with n8n export and n8n import (CLI) to new VPS from scratch (needed For DR process). Have over 250 workflows, 5 credentials, 4 webhooks. Now with version control I am able to import it to new VPS but need to replace exported wf with “Atived: false” and “activeVersionID = null”. The field activeVersionId comes equal to versionID but UUID does not exist on workflow_history. Why? During de import process we have no records in table workflow_history until safe it with dummy changes then able to active and then publish it. But with over 250 workflows this process should be automated. I do not want to backup/restore n8n postgress database, need a process from scracth just having backups and do not want to use any api/workflow process - too slow. I fell with some postgres script will solve it, for every record in workflow_entity then create/update record in workflow_history and update versionId and activeVersionId and so far. But is out of my scope for now. Any suggestions?
Best wishes for all.

Information on your n8n setup

  • n8n version: 2.1.4
  • Database (default: SQLite): Postgres 17
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 24.03.

Hey

This is expected behavior in n8n CE 2.1.x.

  • n8n export/import does not recreate workflow_history.

  • History entries are only created when a workflow is saved via UI or API.

  • Imported workflows are set to active=false by design, so activeVersionId is null or invalid.

And CLI export/import is not a full DR solution.

Try this

  • :white_check_mark: Restore the Postgres DB (only way to fully preserve versions + active state)

  • :white_check_mark: Bulk-activate via API/script after import

  • :cross_mark: Don’t modify workflow_history via SQL (unsafe)