summaryrefslogtreecommitdiff
path: root/tools/purge.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/purge.sh')
-rw-r--r--tools/purge.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/purge.sh b/tools/purge.sh
new file mode 100644
index 0000000..8c1ea7e
--- /dev/null
+++ b/tools/purge.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# Clean out stale games from the database.
+
+sqlite3 db "DELETE FROM games WHERE status = 0 AND mtime < datetime('now', '-7 days')"
+sqlite3 db "UPDATE games SET status = 3 WHERE status = 1 AND mtime < datetime('now', '-28 days')"