@leiweibau consolidation-2022-08-06

This commit is contained in:
jokob-sk
2022-08-06 09:24:46 +10:00
parent 9fd4503ba8
commit 346ac5912c
12 changed files with 385 additions and 50 deletions

View File

@@ -266,12 +266,16 @@ def cleanup_database ():
print ('Cleanup Database')
print (' Timestamp:', startTime )
openDB()
openDB()
strdaystokeepEV = str(365) # str(DAYS_TO_KEEP_EVENTS)
# Cleanup Online History
print ('\nCleanup Online_History...')
sql.execute ("""DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')""")
sql.execute ("DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')")
print ('\nOptimize Database...')
print ('\nCleanup Events, up to the lastest '+strdaystokeepEV+' days...')
sql.execute ("DELETE FROM Events WHERE eve_DateTime <= date('now', '-"+strdaystokeepEV+" day')")
# Shrink DB
print ('\nShrink Database...')
sql.execute ("VACUUM;")
closeDB()