diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 62da8f2f..294b3f6e 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -9,7 +9,7 @@ from alembic import context # Import your models from app.core.database import Base -from app.models import User, Team, Tree, Session, Attachment +from app.models import User, Team, Tree, Session, Attachment, InviteCode from app.core.config import settings # this is the Alembic Config object diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 7be1b8a3..f830f5a9 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -11,7 +11,6 @@ class Settings(BaseSettings): # Database - Railway provides DATABASE_URL, we convert it for asyncpg DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/patherly" - DATABASE_URL_SYNC: str = "postgresql://postgres:postgres@localhost:5432/patherly" @field_validator("DATABASE_URL", mode="before") @classmethod @@ -21,13 +20,10 @@ class Settings(BaseSettings): return v.replace("postgresql://", "postgresql+asyncpg://", 1) return v - @field_validator("DATABASE_URL_SYNC", mode="before") - @classmethod - def ensure_sync_url(cls, v: str) -> str: - """Ensure sync URL uses standard postgresql prefix.""" - if v.startswith("postgresql+asyncpg://"): - return v.replace("postgresql+asyncpg://", "postgresql://", 1) - return v + @property + def DATABASE_URL_SYNC(self) -> str: + """Get sync URL by removing asyncpg prefix from DATABASE_URL.""" + return self.DATABASE_URL.replace("postgresql+asyncpg://", "postgresql://", 1) # JWT Settings SECRET_KEY: str = "your-secret-key-change-in-production-use-openssl-rand-hex-32"