diff --git a/rattail_tempmon/db/model.py b/rattail_tempmon/db/model.py index 485e665..ba7e63a 100644 --- a/rattail_tempmon/db/model.py +++ b/rattail_tempmon/db/model.py @@ -91,6 +91,7 @@ class Probe(Base): """, backref=orm.backref( 'probes', + cascade='all, delete-orphan', doc=""" List of probes connected to this client. """)) @@ -141,7 +142,10 @@ class Reading(Base): Probe, doc=""" Reference to the tempmon probe which took this reading. - """) + """, + backref=orm.backref( + 'readings', + cascade='all, delete-orphan')) taken = sa.Column(sa.DateTime(), nullable=False, default=datetime.datetime.utcnow) degrees_f = sa.Column(sa.Numeric(precision=7, scale=4), nullable=False)