summaryrefslogtreecommitdiff
path: root/tools/purge.sql
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-04-25 12:18:00 +0200
committerTor Andersson <tor@ccxvii.net>2025-04-25 17:56:43 +0200
commitfc3501382c2aa3ef5b692f4f55c2616f9cade3f5 (patch)
treea047bb94f8f1854c621fa0fba5ed62c8e0d0be14 /tools/purge.sql
parented2361980b455d1825d811670f329cbcf5624927 (diff)
downloadserver-fc3501382c2aa3ef5b692f4f55c2616f9cade3f5.tar.gz
Move toolbox scripts to a "bin" directory.
Add a super "rtt" command to run the scripts.
Diffstat (limited to 'tools/purge.sql')
-rw-r--r--tools/purge.sql35
1 files changed, 0 insertions, 35 deletions
diff --git a/tools/purge.sql b/tools/purge.sql
deleted file mode 100644
index 2a95f01..0000000
--- a/tools/purge.sql
+++ /dev/null
@@ -1,35 +0,0 @@
--- Prune game snapshot and game state data to save database space.
-
-attach database 'db' as live;
-
-pragma live.busy_timeout=10000;
-
-create temporary view prune_snap_list as
- select
- distinct game_id
- from
- live.game_snap
- where
- game_id in (
- select game_id from live.games
- where status=2 and date(mtime) < date('now', '-7 days')
- )
- ;
-
-create temporary view prune_all_list as
- select
- distinct game_id
- from
- live.games
- where
- game_id in (
- select game_id from live.games
- where status=2 and date(mtime) < date('now', '-28 days')
- )
- ;
-
-select 'PURGE SNAPS FROM ' || count(1) from prune_snap_list;
-delete from live.game_snap where game_id in (select game_id from prune_snap_list);
-
-select 'PURGE ALL FROM ' || count(1) from prune_all_list;
-update live.games set status = 3 where game_id in (select game_id from prune_all_list);