psycopg failure in CI fixed
This commit is contained in:
parent
0b8a59edcb
commit
ed1395ce19
|
|
@ -25,10 +25,20 @@ from backend.app.models.user import Base
|
||||||
target_metadata = Base.metadata if Base is not None else None
|
target_metadata = Base.metadata if Base is not None else None
|
||||||
|
|
||||||
def get_url():
|
def get_url():
|
||||||
return os.getenv(
|
url = os.getenv(
|
||||||
"DATABASE_URL",
|
"DATABASE_URL",
|
||||||
"postgresql://atb:atb-local-only-change-me@localhost:5432/atb"
|
"postgresql://atb:atb-local-only-change-me@localhost:5432/atb"
|
||||||
)
|
)
|
||||||
|
if url.startswith("postgresql://"):
|
||||||
|
try:
|
||||||
|
import psycopg # noqa: F401
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import psycopg2 # noqa: F401
|
||||||
|
url = url.replace("postgresql://", "postgresql+psycopg2://", 1)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
return url
|
||||||
|
|
||||||
def run_migrations_offline() -> None:
|
def run_migrations_offline() -> None:
|
||||||
url = get_url()
|
url = get_url()
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ fastapi>=0.115.0
|
||||||
uvicorn[standard]>=0.30.0
|
uvicorn[standard]>=0.30.0
|
||||||
sqlalchemy>=2.0.30
|
sqlalchemy>=2.0.30
|
||||||
psycopg2-binary>=2.9.9
|
psycopg2-binary>=2.9.9
|
||||||
|
psycopg[binary]>=3.2.0
|
||||||
alembic>=1.13.0
|
alembic>=1.13.0
|
||||||
pydantic>=2.8.0
|
pydantic>=2.8.0
|
||||||
requests>=2.32.0
|
requests>=2.32.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue