From 54f301ff71f0300f038ea0f0ac0272d1546022dd Mon Sep 17 00:00:00 2001 From: j Date: Sat, 27 Feb 2016 11:21:12 +0530 Subject: [PATCH] cleanup sort/find table --- oml/item/models.py | 2 ++ oml/library.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/oml/item/models.py b/oml/item/models.py index 250bcc4..2032280 100644 --- a/oml/item/models.py +++ b/oml/item/models.py @@ -105,6 +105,8 @@ class Item(db.Model): Sort.query.filter(Sort.item_id.in_(ids)).delete(synchronize_session=False) cls.query.filter(cls.id.in_(ids)).delete(synchronize_session=False) state.db.session.expire_all() + Sort.query.filter_by(item_id=None).delete() + Find.query.filter_by(item_id=None).delete() @classmethod def remove_without_user(cls): diff --git a/oml/library.py b/oml/library.py index 3457f00..db45eae 100644 --- a/oml/library.py +++ b/oml/library.py @@ -340,6 +340,8 @@ def sync_db(): if not state.shutdown: cleanup_peers() logger.debug('peers cleaned up') + item.models.Sort.query.filter_by(item_id=None).delete() + item.models.Find.query.filter_by(item_id=None).delete() def cleanup_lists(): import item.models