Startup error after changing database to postgres

Describe the problem/error/question

I have an n8n instance running in docker, a postgres service set up on the host. I have been using sqlite as n8n database for a while and is trying to switch to postgres. My container failed to startup after updating the docker run command with the required environment variables as stated in the documentation.


When I look into the postgres n8n DB, I only see the migration table is created but it is empty inside.
I am not sure what it is migrating though, as I haven’t imported the credentials and workflows into n8n yet, it should be a fresh start.

What is the error message (if any)?

2023-08-31T06:27:41.328Z | debug    | Lazy Loading credentials and nodes from n8n-nodes-base "{\n  credentials: 320,\n  nodes: 431,\n  file: 'DirectoryLoader.js',\n  function: 'loadAll'\n}"
n8n ready on, port 5678
2023-08-31T06:27:41.494Z | warn     | Migrations in progress, please do NOT stop the process. "{ file: 'migrationHelpers.js', function: 'logMigrationStart' }"
2023-08-31T06:27:41.494Z | debug    | Starting migration InitialMigration1587669153312 "{ file: 'migrationHelpers.js', function: 'logMigrationStart' }"
2023-08-31T06:27:41.541Z | error    | Error: There was an error running database migrations "{ file: 'ErrorReporterProxy.js', function: 'report' }"
2023-08-31T06:27:41.541Z | error    | QueryFailedError: syntax error at or near "NOT" "{ file: 'ErrorReporter

N8N Version

v1.1.1 (running inside Docker container)

Postgres Version

psql (PostgreSQL) 9.2.24 (running on the host)

Hey @hugo222,

Welcome to the community :tada:

As it is a new database I would be tempted to clear it and start again, I would also try a newer n8n version to see if that helps.