diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-05 02:19:49 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-01-06 12:11:09 +0100 |
commit | 72ebf85bc7f3a5f8fdf37e96a319ccbb8ea5768d (patch) | |
tree | 36f59c534bcdb698bb05a91938bd1ce6427f5f78 /tools/purge.sh | |
parent | e110778a3f4c706a307e70ce7f4bd38a22a2e2bc (diff) | |
download | server-72ebf85bc7f3a5f8fdf37e96a319ccbb8ea5768d.tar.gz |
Update purge script to delete really old solo games.
Diffstat (limited to 'tools/purge.sh')
-rw-r--r-- | tools/purge.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/purge.sh b/tools/purge.sh index b1db2a7..74e1deb 100644 --- a/tools/purge.sh +++ b/tools/purge.sh @@ -4,6 +4,7 @@ WHERE_TIMEOUT_OPEN="WHERE status = 0 AND mtime < 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 -cmd "pragma foreign_keys=1" "SELECT * FROM game_view $WHERE_TIMEOUT_OPEN" @@ -13,8 +14,12 @@ echo "--- TIMED OUT ACTIVE GAMES ---" sqlite3 db -cmd "pragma foreign_keys=1" "SELECT * FROM game_view $WHERE_TIMEOUT_ACTIVE" sqlite3 db -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 -cmd "pragma foreign_keys=1" "SELECT * FROM game_full_view $WHERE_TIMEOUT_SOLO" +sqlite3 db -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 -cmd "pragma foreign_keys=1" "SELECT message_id, from_name, to_name, subject FROM message_view WHERE deleted_from_inbox=1 AND deleted_from_outbox=1" -sqlite3 db -cmd "pragma foreign_keys=1" "DELETE FROM messages WHERE deleted_from_inbox=1 AND deleted_from_outbox=1" +sqlite3 db -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 -cmd "pragma foreign_keys=1" "DELETE FROM messages WHERE is_deleted_from_inbox=1 AND is_deleted_from_outbox=1" sqlite3 db -cmd "pragma foreign_keys=1" "DELETE FROM game_replay WHERE game_id < 1346" |