diff --git a/seahub/base/management/commands/clean_db_records.py b/seahub/base/management/commands/clean_db_records.py index 7743605f26..eb61fabea4 100644 --- a/seahub/base/management/commands/clean_db_records.py +++ b/seahub/base/management/commands/clean_db_records.py @@ -18,6 +18,7 @@ class Command(BaseCommand): clean_sql4 = "DELETE FROM FileUpdate WHERE to_days(now()) - to_days(timestamp) > 90" clean_sql5 = "DELETE FROM FileHistory WHERE to_days(now()) - to_days(timestamp) > 90" clean_sql6 = "DELETE FROM PermAudit WHERE to_days(now()) - to_days(timestamp) > 90" + clean_sql7 = "DELETE FROM FileTrash WHERE to_days(now()) - to_days(delete_time) > 90" def handle(self, *args, **options): logger.debug('Start clean database records.') @@ -35,6 +36,7 @@ class Command(BaseCommand): cursor.execute(self.clean_sql4) cursor.execute(self.clean_sql5) cursor.execute(self.clean_sql6) + cursor.execute(self.clean_sql7) except Exception as e: logger.error('Failed to clean database records, error: %s.' % e) self.stderr.write('[%s] Failed to clean database records, error: %s.' % (datetime.now(), e))