diff --git a/app/models/session.py b/app/models/session.py index 900c8e7..3c59e58 100644 --- a/app/models/session.py +++ b/app/models/session.py @@ -10,9 +10,9 @@ class Session(db.Model): name: Mapped[str] = mapped_column(unique=True) authorized: Mapped[bool] - users: Mapped[List[User]] = relationship("User", back_populates="session") + users: Mapped[List[User]] = relationship("User", cascade="all, delete-orphan", back_populates="session") - tasks: Mapped[List[Task]] = relationship("Task", back_populates="session") + tasks: Mapped[List[Task]] = relationship("Task", cascade="all, delete-orphan", back_populates="session") def has_depending_tasks(self): tasks = Task.query \