mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
Update clean_db_records.py (#6902)
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user