Migrating from Sqlite to Postgres Assistance

Hi, so I am moving from sqlite to postgres and I have been following the @MutedJam instructions. Managed to move the credentials but the workflow_entity is a night mare. Errors on every import I attempt. I amm using pgAdmin 4. I have attached my csv file, I have no idea where I am going wrong and why I keep getting errors. I have reduced the csv to one line and still errors galore. Help! Here is a snippet of the csv. I am going nuts with all these errors from 1 simple line

id,name,active,nodes,connections,createdAt,updatedAt,settings,staticData,pinData,versionId,triggerCount,meta
2pgtqVopgk7ERvvN1,Test,0,{},{},2024-09-21 10:30:00,2024-09-21 10:30:00,{},,{},d7a9f00a-071f-4a5a-81d4-0b7f4e6bb2e8,0,{}

Information on your n8n setup

  • **n8n version:1.59.4
  • **Database : (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via : (Docker, npm, n8n cloud, desktop app): Docker
  • **Operating system: Ubuntu

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Sorry I do not follow.
You are importing the data via the cli or just entering the data into the database via sql?
There is linked tables so just entering it into the sql is going to cause issues.
Should be able to get it to work, but need to be careful.

If there arent too many flows I would just insert them via copy paste in browser and relink the credentials.

Hi, thanks for feedback. I realized doing the workflow_entity import option is a night mare via csv, dont use it, maybe for credentials_entity it seems to work but if you have many workflows, just dont use CSV method. So I just entered some few workflow data ids manually via pgAdmin4 just to have at least something in the workflow_entity table. it wasn’t a lot and succeeded. Luckily I have all my json backup workflows intact, its now just a case of importing them back after moving into postgres. However if anyone is moving to postgres, be careful with csv imports.

Hi @Keep_Innovations, sorry for the confusion and sorry for my late reply. I saw your DM only now.

I can see that you’re referring to my post at How to migrate from SQLite to PostgreSQL? - #5 by MutedJam. If you scroll down a bit, you will see that I suggested using the CLI in a response a couple of years after I originally posted the manual instructions.

I’ve now edited the original post to also include this information, but for visibility I’ll copy it here too:

This post was written a long time ago when n8n was using a very different database structure and did not have the functionality to export/import data stored in the database.

So please do not follow these steps anymore. Instead, refer to the CLI instructions at CLI commands | n8n Docs for information on how to export data from one n8n instance and import it to another.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.