Prod to staging database import

Describe the problem/error/question

Hi everyone,
currently in the 2.4.6 version of the application, before the upgrade of my production environnement I would like to deploy a stagging env.

Since I have many user with many workflow. I would like them to be able to test their workflow on staging before the upgrade of production.

I would like to load the production dump into my stagging PostGre pod, disable all the workflow and then deploy my helm chart containing my n8n pod preventing any unwanted trigger.

On postgreSQL could I use this request
UPDATE workflow_entity SET active = false;
Will this disable all the workflow ?

Thanking you a lot for the answer you could provide me.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.4.6
  • Database : PostGreSQL 16
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Kubernetes SelfHosted
  • Operating system: Official docker image

yes that query will work but there’s a catch.

n8n caches workflow state in memory so if you run that SQL update while n8n is already running it won’t pick up the change. you need to run the UPDATE before starting your n8n pod, then bring n8n up. that way it reads the disabled state fresh on boot and nothing triggers.

so your order should be: restore the prod dump into staging postgres, run the UPDATE to disable everything, then deploy your helm chart and start the n8n pod.

one thing worth double checking after it comes up, go into the n8n UI and confirm the workflows show as inactive. just to be safe before you hand it off to users for testing.

welcome to the n8n community @marredecejob
One additional thing to watch in queue mode is that webhook registrations and polling triggers may already exist from the production database state, so for a staging environment I would also avoid exposing staging webhooks externally until you confirm all workflows are inactive and workers are connected only to the staging Redis/Postgres setup.

@ahadarain @tamy.santos Thank you very much both for your answer and the information provided, I will try it and confirm it work before closing the topic !