How do I transfer my sqlite data into postgres

Hello everyone!
I am new to N8n and I am self hosting N8n using docker.
Previously, I had the default database set to sqlite, now that I want to connect my N8n to postgres db, how do I migrate all my data from sqlite to postgres?

Hi Pratikshya_Karki welcome to n8n community :n8n:

To migrate n8n via Docker, you can use the n8n CLI feature or even its REST API via your own n8n instance, by backing up your workflows and credentials.

For documentation on backing up with the n8n CLI, you can follow this guide:

To back up via the n8n REST API, you can use the following workflow template:

1 Like

In addition to what @tridi said, I also recall that it’s important to copy the current N8N_ENCRYPTION_KEY and pass it as an environment variable in the new Docker setup…

1 Like

I already do have a backup file for workflows and credentials in a database.sqlite file. The problem is I do not know how do I transfer this to the new n8n instance that has postgres as db.