core (memory/sqla_mapping): delete-orphan in History:
add `cascade=delete-orphan` to History's `messages`, `subjects` and `thread`, to make modification of those attributes easier.
This commit is contained in:
parent
191d06126e
commit
445d5c088e
1 changed files with 17 additions and 3 deletions
|
|
@ -299,10 +299,24 @@ class History(Base):
|
|||
extra = Column(LegacyPickle)
|
||||
|
||||
profile = relationship("Profile")
|
||||
messages = relationship("Message", backref="history", passive_deletes=True)
|
||||
subjects = relationship("Subject", backref="history", passive_deletes=True)
|
||||
messages = relationship(
|
||||
"Message",
|
||||
backref="history",
|
||||
cascade="all, delete-orphan",
|
||||
passive_deletes=True
|
||||
)
|
||||
subjects = relationship(
|
||||
"Subject",
|
||||
backref="history",
|
||||
cascade="all, delete-orphan",
|
||||
passive_deletes=True
|
||||
)
|
||||
thread = relationship(
|
||||
"Thread", uselist=False, back_populates="history", passive_deletes=True
|
||||
"Thread",
|
||||
uselist=False,
|
||||
back_populates="history",
|
||||
cascade="all, delete-orphan",
|
||||
passive_deletes=True
|
||||
)
|
||||
__mapper_args__ = {"version_id_col": version_id}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue