File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ class SampleAssociation(Base):
210
210
child_id : Mapped [int ] = mapped_column (ForeignKey ("samples.id" ), primary_key = True )
211
211
212
212
# This is the crucial column that links to the specific child's task
213
- task_id : Mapped [int ] = mapped_column (ForeignKey ("tasks.id" ), primary_key = True )
213
+ task_id : Mapped [int ] = mapped_column (ForeignKey ("tasks.id" , ondelete = "CASCADE" ), primary_key = True )
214
214
215
215
# Relationships from the association object itself
216
216
parent : Mapped ["Sample" ] = relationship (foreign_keys = [parent_id ], back_populates = "child_links" )
@@ -529,7 +529,7 @@ class Task(Base):
529
529
user_id : Mapped [Optional [int ]] = mapped_column (nullable = True )
530
530
531
531
# The Task is linked to one specific parent/child association event
532
- association : Mapped [Optional ["SampleAssociation" ]] = relationship (back_populates = "task" )
532
+ association : Mapped [Optional ["SampleAssociation" ]] = relationship (back_populates = "task" , cascade = "all, delete-orphan" )
533
533
534
534
__table_args__ = (
535
535
Index ("category_index" , "category" ),
You can’t perform that action at this time.
0 commit comments