Skip to content

Commit

Permalink
refactor: ♻️ Make sure the foreign key does what it is supposed to do…
Browse files Browse the repository at this point in the history
… in StrikeLineDescriptor
  • Loading branch information
egrelier committed Dec 8, 2023
1 parent 044f115 commit 2caebf5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion thermal_events/strike_line_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class StrikeLineDescriptor(Base):

thermal_event_instance_id = Column(
BigIntegerType,
ForeignKey("thermal_events_instances.id"),
ForeignKey(
"thermal_events_instances.id", onupdate="CASCADE", ondelete="CASCADE"
),
index=True,
comment="The id of the thermal event instance described by the descriptor",
)
Expand All @@ -56,6 +58,7 @@ class StrikeLineDescriptor(Base):
instance = relationship(
"ThermalEventInstance",
lazy="subquery",
passive_deletes=True,
back_populates="strike_line_descriptor",
)

Expand Down
4 changes: 3 additions & 1 deletion thermal_events/thermal_event_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ class ThermalEventInstance(Base):
)

strike_line_descriptor = relationship(
"StrikeLineDescriptor", back_populates="instance", cascade="all, delete-orphan"
"StrikeLineDescriptor",
back_populates="instance",
cascade="all, delete, delete-orphan",
)

_buffer = None # image bugger used to draw polygons
Expand Down

0 comments on commit 2caebf5

Please sign in to comment.