From 83835ea22d7e169f80d8740ce8a542103257d173 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 24 Nov 2022 21:23:56 +0100 Subject: Remove obsolete tools and update other tools. --- tools/purge.sh | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 tools/purge.sh (limited to 'tools/purge.sh') diff --git a/tools/purge.sh b/tools/purge.sh deleted file mode 100644 index 10cee16..0000000 --- a/tools/purge.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Clean out stale games from the database. - -WHERE_TIMEOUT_OPEN="WHERE status = 0 AND ctime < datetime('now', '-7 days')" -WHERE_TIMEOUT_ACTIVE="WHERE status = 1 AND mtime < datetime('now', '-14 days')" -WHERE_TIMEOUT_SOLO="WHERE status = 2 AND mtime < datetime('now', '-3 months') AND is_solo=1" - -echo "--- TIMED OUT OPEN GAMES ---" -sqlite3 db -box -cmd "pragma foreign_keys=1" "SELECT * FROM game_view $WHERE_TIMEOUT_OPEN" -sqlite3 db -box -cmd "pragma foreign_keys=1" "DELETE FROM games WHERE game_id IN ( SELECT game_id FROM game_view $WHERE_TIMEOUT_OPEN )" - -echo "--- TIMED OUT ACTIVE GAMES ---" -sqlite3 db -box -cmd "pragma foreign_keys=1" "SELECT * FROM game_view $WHERE_TIMEOUT_ACTIVE" -sqlite3 db -box -cmd "pragma foreign_keys=1" "UPDATE games SET status = 3 WHERE game_id IN ( SELECT game_id FROM game_view $WHERE_TIMEOUT_ACTIVE )" - -echo "--- ANCIENT SOLO GAMES ---" -sqlite3 db -box -cmd "pragma foreign_keys=1" "SELECT * FROM game_full_view $WHERE_TIMEOUT_SOLO" -sqlite3 db -box -cmd "pragma foreign_keys=1" "UPDATE games SET status = 3 WHERE game_id IN ( SELECT game_id FROM game_full_view $WHERE_TIMEOUT_SOLO )" - -echo "--- DELETED MESSAGES ---" -sqlite3 db -box -cmd "pragma foreign_keys=1" "SELECT message_id, from_name, to_name, subject FROM message_view WHERE is_deleted_from_inbox=1 AND is_deleted_from_outbox=1" -sqlite3 db -box -cmd "pragma foreign_keys=1" "DELETE FROM messages WHERE is_deleted_from_inbox=1 AND is_deleted_from_outbox=1" - -sqlite3 db -box -cmd "pragma foreign_keys=1" "DELETE FROM game_replay WHERE game_id < 1346" -- cgit v1.2.3