Thought I might share this for whoever needs it, as there is a major lack of info around to achieve this without having to set everything back up (other than workflow and credentials)
This is especially relevant if you have more than 1 user, so you can keep the workflows and credentials that the users had
This is just going to be a quick guide.
-
Follow the CLI commands to export your workflow and Creds
CLI commands | n8n Docs -
Get yourself an SQLite browser like DB Browser for SQLite.
Open your SQlite file with this. -
Export the tables to csv
Namely
-credentials_entity
-folder
-project
-project_relation
-shared_credentials
-shared_workflow
-user
-webhook_entity
-workflow_entity
You can also get your workflow histories etc if you like as well,
-
Reconfigure your N8n to use postgres (supabase is a great option here, for config details click Connect in the top of the database, select connection string and select the type as “PSQL” to get the specifics to use it with N8N.)
DB_TYPE=postgresdb
DB_POSTGRESDB_DATABASE=postgres
DB_POSTGRESDB_HOST=aws-0-eu-centr.supabase.com
DB_POSTGRESDB_PORT=6543
DB_POSTGRESDB_USER=postgres.ydw
DB_POSTGRESDB_PASSWORD=Z7a#W -
Start up n8n and let it create all the database tables
-
Import the workflows and credentials via the CLI commands
-
import the csv files to the relevant tables in postgres. You need to import project folder before folders
-
NOTE: You will need to delete the imported shared_workflow and shared_Credentials
-
Delete the default user that is created in users
-
in N8N settings set userManagement.isinstanceownersetup = true
-
Restart the docker and you should be able to log in with your original user/pass and have all your workflows
-
Enter your license key
Hope this helps someone and saves them the few hours I lost today after having my sqlite crash