Opened 12 years ago

Closed 12 years ago

#611 closed defect (fixed)

Account deletion does not delete the media entries

Reported by: joar Owned by: Elrond
Priority: critical Milestone: 0.3.3
Component: programming Keywords: sql
Cc: Parent Tickets:

Description

When removing your account via your account settings page, the media files are deleted, but *not* the media entries themselves.

Change History (4)

comment:1 by joar, 12 years ago

Owner: set to joar
Status: newassigned

comment:2 by joar, 12 years ago

Keywords: sql added
Owner: changed from joar to Elrond

comment:3 by Elrond, 12 years ago

My time is currently very limited. So if someone else wants to take this, go ahead, without asking me.

Anyway, idea:

  1. Have user A and B.
  2. User B creates media M.
  3. User A post a comment on M.
  4. User A deletes his own account.

Solution:
In MediaComment:

-    get_author = relationship(User)
+    get_author = relationship(User,
+                              backref=backref("posted_comments",
+                                              cascade="all, delete-orphan"))

And take a deep look at http://docs.sqlalchemy.org/en/rel_0_7/orm/collections.html#largecollections because the number of comments by a user might be very large, so we should probably use a subquery instead of loading them on access of the attribute.

Bonus points for a testcase!

Version 0, edited 12 years ago by Elrond (next)

comment:4 by Elrond, 12 years ago

Milestone: 0.3.3
Resolution: fixed
Status: assignedclosed

Okay, fixed in ff68ca9fc2b329d1c2ec395abf50358845c4e5fc.

Note: See TracTickets for help on using tickets.