Skip to content

Railway Deployment #cb4ed8 fix: use psycopg v3 URL scheme in db.py#85

Merged
mrwrite merged 1 commit into
mainfrom
railway/fix-deploy-cb4ed8
Jul 11, 2026
Merged

Railway Deployment #cb4ed8 fix: use psycopg v3 URL scheme in db.py#85
mrwrite merged 1 commit into
mainfrom
railway/fix-deploy-cb4ed8

Conversation

@railway-app

@railway-app railway-app Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Problem

The pre-deploy alembic migration failed with ModuleNotFoundError: No module named 'psycopg2'. The app declares psycopg[binary] (psycopg v3) as its Postgres driver, but create_engine() was called with the bare DATABASE_URL, whose "postgresql://" scheme SQLAlchemy maps to the psycopg2 dialect by default, and psycopg2 is never installed.

Solution

Added a _normalize_db_url helper in apps/api/app/core/db.py that rewrites "postgres://"/"postgresql://" URLs to "postgresql+psycopg://" before passing them to create_engine, so SQLAlchemy selects the installed psycopg v3 dialect. Alembic's env.py reads settings.database_url through the same config path, so this fixes both the app engine and the migration.

Changes

  • Modified apps/api/app/core/db.py

Context

  • Deployment: #cb4ed8
  • Failed commit: 48f8b25

Generated by Railway

@mrwrite
mrwrite merged commit eead718 into main Jul 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant