feat: auto cleanup with retention period, storage limit, settings UI
This commit is contained in:
@@ -42,3 +42,16 @@ async def init_db():
|
||||
await conn.execute(text(col_def))
|
||||
except Exception:
|
||||
pass # Column already exists
|
||||
|
||||
# Seed default cleanup settings (only if not already set)
|
||||
defaults = {
|
||||
"cleanup_enabled": "true",
|
||||
"cleanup_retention_minutes": "10080", # 7 days
|
||||
"cleanup_storage_limit_pct": "80",
|
||||
"cleanup_last_run": "",
|
||||
"cleanup_last_result": "",
|
||||
}
|
||||
for k, v in defaults.items():
|
||||
await conn.execute(text(
|
||||
"INSERT OR IGNORE INTO app_settings (key, value, updated_at) VALUES (:k, :v, datetime('now'))"
|
||||
), {"k": k, "v": v})
|
||||
|
||||
Reference in New Issue
Block a user