Hi
There are quite a few posts about migrating from the default SQLite to PostgreSQL, several of which I’ve read through. Most of the posts seem to be about migrating data, credentials, workflows, etc on active or production instances of n8n. I’m however looking for a simple switch from SQLite to PostgreSQL and not really a full migration.
The self-hosted n8n instance was setup as a test environment, where I could learn n8n and test workflows. So not a production environment with any active workflows. I’m not to worried about losing the workflows, credentials and execution data when making the switch.
Obviously, one option is start up a new fresh n8n instance with PostgreSQL from the start. But, for various reasons, I don’t want to start fresh and want to retain the server setup and the rest of the n8n instance config.
Any suggestions how the switch can be made?
Hi @OptimaBSC i think you just need to update your compose file, with DB_TYPE=postgresdb along with the required DB_POSTGRESDB_* environment variables on your n8n container and then run it via docker compose up -d so now the old data will be left and new data will be settled.
Essentially, yes. The init-data.sh file tripped me up, though as I didn’t create that initially.
In the process I did remove the volumes and recreate when restarting docker. This wiped the slate clean, removing all workflows, credentials and data tables, as well as clearing the n8n self-hosted activation key. This wasn’t an issue for me, since this is a ‘sand box’ instance.