diff --git a/apps/api/alembic/env.py b/apps/api/alembic/env.py index 37e8332..cf5ad7d 100644 --- a/apps/api/alembic/env.py +++ b/apps/api/alembic/env.py @@ -1,5 +1,6 @@ import os from logging.config import fileConfig +from urllib.parse import unquote from sqlalchemy import engine_from_config, pool @@ -14,6 +15,9 @@ database_url = os.environ.get("DATABASE_URL") if database_url: # Alembic needs the synchronous driver database_url = database_url.replace("postgresql+asyncpg://", "postgresql://") + # Decode URL-encoded characters (e.g. %40 -> @) so ConfigParser + # interpolation doesn't choke on them + database_url = unquote(database_url) config.set_main_option("sqlalchemy.url", database_url) # Set up Python logging from the config file