The tables are not created when I am trying to use the postgres as alternate database. The n8n is self hosted. The database.sqlite gets created which shows the switch is not happening

Describe the problem/error/question

When I try to use Postgres as an alternate database, the tables are not created. The n8n is self-hosted. The database.sqlite @ /home/node/.n8n gets created, which shows that the switch is not happening. The logs are also not showing any evident of using postgres. Am I missing anything to achieve switch

environment used in the docker-compose file:
- DB_PROTOCOL=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=postgres
- DB_POSTGRESDB_USER=admin
- DB_POSTGRESDB_PASSWORD=admin
- DB_POSTGRESDB_SCHEMA=n8n
- N8N_LOG_LEVEL=debug

What is the error message (if any)?

No error messages

Please share your workflow

Not applicable

Share the output returned by the last node

Information on your n8n setup

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

I think your first line should be DB_TYPE. I also don’t have a SCHEMA line, but that’s probably not vital

My docker compose lines (which work):
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}

1 Like

yep, DB_TYPE should be used. There is no DB_PROTOCOL env

Database environment variables | n8n Docs