mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +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
|
|
@ -11,6 +11,7 @@ from sqlalchemy import (
|
|||
Integer,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.db import BaseModel, TimestampMixin
|
||||
|
||||
|
|
@ -44,3 +45,10 @@ class AutomationTrigger(BaseModel, TimestampMixin):
|
|||
)
|
||||
|
||||
last_fired_at = Column(TIMESTAMP(timezone=True), nullable=True)
|
||||
|
||||
automation = relationship("Automation", back_populates="triggers")
|
||||
runs = relationship(
|
||||
"AutomationRun",
|
||||
back_populates="trigger",
|
||||
passive_deletes=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue