mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
handle DB foreign key constraint for ModLog entries
This commit is contained in:
parent
f98e8eaf5a
commit
23a6b2673e
1 changed files with 2 additions and 0 deletions
|
@ -631,6 +631,7 @@ class Community(db.Model):
|
|||
db.session.query(CommunityJoinRequest).filter(CommunityJoinRequest.community_id == self.id).delete()
|
||||
db.session.query(CommunityMember).filter(CommunityMember.community_id == self.id).delete()
|
||||
db.session.query(Report).filter(Report.suspect_community_id == self.id).delete()
|
||||
db.session.query(ModLog).filter(ModLog.community_id == self.id).delete()
|
||||
|
||||
|
||||
user_role = db.Table('user_role',
|
||||
|
@ -1021,6 +1022,7 @@ class User(UserMixin, db.Model):
|
|||
db.session.query(PollChoiceVote).filter(PollChoiceVote.user_id == self.id).delete()
|
||||
db.session.query(PostBookmark).filter(PostBookmark.user_id == self.id).delete()
|
||||
db.session.query(PostReplyBookmark).filter(PostReplyBookmark.user_id == self.id).delete()
|
||||
db.session.query(ModLog).filter(ModLog.user_id == self.id).delete()
|
||||
|
||||
def purge_content(self, soft=True):
|
||||
files = File.query.join(Post).filter(Post.user_id == self.id).all()
|
||||
|
|
Loading…
Add table
Reference in a new issue