fix: update Item and TripItem relationships to allow for deletion of items
This commit is contained in:
parent
f390ce80d6
commit
57d7dd46ce
1 changed files with 3 additions and 2 deletions
|
|
@ -64,7 +64,8 @@ class Item(Base):
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
|
|
||||||
user = relationship("User", backref="items")
|
user = relationship("User", backref="items")
|
||||||
tags = relationship("Tag", secondary=item_tag_table, backref="items", cascade="all, delete")
|
tags = relationship("Tag", secondary=item_tag_table, backref="items")
|
||||||
|
trip_items = relationship("TripItem", back_populates="item", cascade="all, delete-orphan")
|
||||||
|
|
||||||
|
|
||||||
class Trip(Base):
|
class Trip(Base):
|
||||||
|
|
@ -89,5 +90,5 @@ class TripItem(Base):
|
||||||
tag_id = Column(UUID(as_uuid=True), ForeignKey("tag.id"), nullable=True)
|
tag_id = Column(UUID(as_uuid=True), ForeignKey("tag.id"), nullable=True)
|
||||||
|
|
||||||
trip = relationship("Trip", backref="trip_items")
|
trip = relationship("Trip", backref="trip_items")
|
||||||
item = relationship("Item", backref="trip_items")
|
item = relationship("Item", back_populates="trip_items")
|
||||||
tag = relationship("Tag", backref="trip_items")
|
tag = relationship("Tag", backref="trip_items")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue