cleanup sort/find table
This commit is contained in:
parent
be1c4085f2
commit
54f301ff71
2 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,8 @@ class Item(db.Model):
|
||||||
Sort.query.filter(Sort.item_id.in_(ids)).delete(synchronize_session=False)
|
Sort.query.filter(Sort.item_id.in_(ids)).delete(synchronize_session=False)
|
||||||
cls.query.filter(cls.id.in_(ids)).delete(synchronize_session=False)
|
cls.query.filter(cls.id.in_(ids)).delete(synchronize_session=False)
|
||||||
state.db.session.expire_all()
|
state.db.session.expire_all()
|
||||||
|
Sort.query.filter_by(item_id=None).delete()
|
||||||
|
Find.query.filter_by(item_id=None).delete()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def remove_without_user(cls):
|
def remove_without_user(cls):
|
||||||
|
|
|
@ -340,6 +340,8 @@ def sync_db():
|
||||||
if not state.shutdown:
|
if not state.shutdown:
|
||||||
cleanup_peers()
|
cleanup_peers()
|
||||||
logger.debug('peers cleaned up')
|
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():
|
def cleanup_lists():
|
||||||
import item.models
|
import item.models
|
||||||
|
|
Loading…
Add table
Reference in a new issue