diff --git a/backend/app/db/database.py b/backend/app/db/database.py index 6717f45..955adb5 100644 --- a/backend/app/db/database.py +++ b/backend/app/db/database.py @@ -61,6 +61,8 @@ async def init_db() -> None: await conn.exec_driver_sql("ALTER TABLE nodes ADD COLUMN bottom_handles INTEGER NOT NULL DEFAULT 1") with suppress(OperationalError): await conn.exec_driver_sql("ALTER TABLE pending_devices ADD COLUMN discovery_source TEXT") + with suppress(OperationalError): + await conn.exec_driver_sql("ALTER TABLE edges ADD COLUMN waypoints JSON") # Migrate animated column from boolean (0/1) to string ('none'/'snake') with suppress(OperationalError): await conn.exec_driver_sql("UPDATE edges SET animated = 'snake' WHERE animated = '1' OR animated = 1") diff --git a/backend/app/db/models.py b/backend/app/db/models.py index 0aac1b0..903dbc6 100644 --- a/backend/app/db/models.py +++ b/backend/app/db/models.py @@ -69,6 +69,7 @@ class Edge(Base): animated: Mapped[str] = mapped_column(String, nullable=False, default='none') source_handle: Mapped[str | None] = mapped_column(String) target_handle: Mapped[str | None] = mapped_column(String) + waypoints: Mapped[list | None] = mapped_column(JSON, nullable=True) created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) diff --git a/backend/app/schemas/canvas.py b/backend/app/schemas/canvas.py index 5f1e5d4..ea2ec7d 100644 --- a/backend/app/schemas/canvas.py +++ b/backend/app/schemas/canvas.py @@ -49,6 +49,7 @@ class EdgeSave(BaseModel): animated: str = 'none' source_handle: str | None = None target_handle: str | None = None + waypoints: list | None = None @field_validator('animated', mode='before') @classmethod diff --git a/backend/app/schemas/edges.py b/backend/app/schemas/edges.py index a663806..9c83d8a 100644 --- a/backend/app/schemas/edges.py +++ b/backend/app/schemas/edges.py @@ -17,6 +17,7 @@ class EdgeBase(BaseModel): animated: str = 'none' source_handle: str | None = None target_handle: str | None = None + waypoints: list | None = None @field_validator('animated', mode='before') @classmethod @@ -38,6 +39,7 @@ class EdgeUpdate(BaseModel): animated: str | None = None source_handle: str | None = None target_handle: str | None = None + waypoints: list | None = None @field_validator('animated', mode='before') @classmethod