From ad5a0bfbf6d0f00caf76bf89b6429d02a1aea114 Mon Sep 17 00:00:00 2001 From: Dennis Boldt Date: Sat, 21 May 2022 14:21:58 +0200 Subject: [PATCH] Fix #206 - Overtaking events are deleted now, when the parent track is deleted --- README.md | 2 +- api/obs/api/db.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5315aa0..1fbbd7f 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ to import the whole region you are serving. ```bash osm2pgsql --create --hstore --style roads_import.lua -O flex \ - -H localhost -d obs -U obs \ + -H localhost -d obs -U obs -W \ path/to/downloaded/myarea-latest.osm.pbf ``` diff --git a/api/obs/api/db.py b/api/obs/api/db.py index 00f849d..8830574 100644 --- a/api/obs/api/db.py +++ b/api/obs/api/db.py @@ -403,22 +403,22 @@ class Comment(Base): Comment.author = relationship("User", back_populates="authored_comments") User.authored_comments = relationship( - "Comment", order_by=Comment.created_at, back_populates="author" + "Comment", order_by=Comment.created_at, back_populates="author", passive_deletes=True ) Track.author = relationship("User", back_populates="authored_tracks") User.authored_tracks = relationship( - "Track", order_by=Track.created_at, back_populates="author" + "Track", order_by=Track.created_at, back_populates="author", passive_deletes=True ) Comment.track = relationship("Track", back_populates="comments") Track.comments = relationship( - "Comment", order_by=Comment.created_at, back_populates="track" + "Comment", order_by=Comment.created_at, back_populates="track", passive_deletes=True ) OvertakingEvent.track = relationship("Track", back_populates="overtaking_events") Track.overtaking_events = relationship( - "OvertakingEvent", order_by=OvertakingEvent.time, back_populates="track" + "OvertakingEvent", order_by=OvertakingEvent.time, back_populates="track", passive_deletes=True )