diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 7ebf571..e647447 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -21,8 +21,17 @@ if config.config_file_name is not None: fileConfig(config.config_file_name) # Get database URL from settings -settings = get_settings() -config.set_main_option("sqlalchemy.url", settings.database_url) +import os + +db_url = os.environ.get("DATABASE_URL") +if not db_url: + raise RuntimeError("DATABASE_URL is not set") + +# Alembic sync-only URL +db_url = db_url.replace("sqlite+aiosqlite://", "sqlite:///") +db_url = db_url.replace("postgresql+asyncpg://", "postgresql://") + +config.set_main_option("sqlalchemy.url", db_url) # Add your model's MetaData object here for 'autogenerate' support target_metadata = Base.metadata