diff --git a/apiv2/database/models/tomogram_voxel_spacing.py b/apiv2/database/models/tomogram_voxel_spacing.py index 304e1b5f..7e5c1f8b 100644 --- a/apiv2/database/models/tomogram_voxel_spacing.py +++ b/apiv2/database/models/tomogram_voxel_spacing.py @@ -38,6 +38,7 @@ class TomogramVoxelSpacing(Base): back_populates="tomogram_voxel_spacing", uselist=True, foreign_keys="AnnotationFile.tomogram_voxel_spacing_id", + cascade="all, delete-orphan", ) run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( diff --git a/apiv2/schema/schema.yaml b/apiv2/schema/schema.yaml index e1f45854..e1e1dc4f 100644 --- a/apiv2/schema/schema.yaml +++ b/apiv2/schema/schema.yaml @@ -2203,6 +2203,8 @@ classes: multivalued: true inverse: AnnotationFile.tomogram_voxel_spacing range: AnnotationFile + annotations: + cascade_delete: true run: name: run from_schema: cdp-dataset-config