mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-31 19:45:15 +02:00
feat(automation): wire SQLAlchemy relationships on both sides
This commit is contained in:
parent
7ac99b89a0
commit
7f4c1c25ab
4 changed files with 60 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ from sqlalchemy import (
|
|||
Text,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.db import BaseModel, TimestampMixin
|
||||
|
||||
|
|
@ -59,3 +60,18 @@ class Automation(BaseModel, TimestampMixin):
|
|||
onupdate=lambda: datetime.now(UTC),
|
||||
index=True,
|
||||
)
|
||||
|
||||
search_space = relationship("SearchSpace", back_populates="automations")
|
||||
created_by = relationship("User", back_populates="automations")
|
||||
triggers = relationship(
|
||||
"AutomationTrigger",
|
||||
back_populates="automation",
|
||||
cascade="all, delete-orphan",
|
||||
passive_deletes=True,
|
||||
)
|
||||
runs = relationship(
|
||||
"AutomationRun",
|
||||
back_populates="automation",
|
||||
cascade="all, delete-orphan",
|
||||
passive_deletes=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue