summaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-01 15:02:17 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-01 15:02:17 +0200
commit758043c4275498c94eeed26213536052349dd449 (patch)
tree7f0364552138b2fd148b4140f0faeb10b2681612 /schema.sql
parenta07c8e521a06ec7228edba8ca65c6ec9b81a1f7e (diff)
downloadserver-758043c4275498c94eeed26213536052349dd449.tar.gz
Add "snapshot" replay view during play.
Snapshots store game state without undo and only log length. Combined with the final game state's log we can recreate the view from any snapshot quickly. Move replay code into separate script file, loaded only when used. Prefix system "setup", "resign", and "restore" actions with a period.
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql10
1 files changed, 9 insertions, 1 deletions
diff --git a/schema.sql b/schema.sql
index 95e2690..f959720 100644
--- a/schema.sql
+++ b/schema.sql
@@ -322,10 +322,17 @@ create table if not exists game_replay (
replay_id integer,
role text,
action text,
- arguments json, -- numeric affinity is more compact for numbers
+ arguments json,
primary key (game_id, replay_id)
) without rowid;
+create table if not exists game_snap (
+ game_id integer,
+ snap_id integer,
+ state text,
+ primary key (game_id, snap_id)
+);
+
create table if not exists game_notes (
game_id integer,
role text,
@@ -440,6 +447,7 @@ begin
delete from game_state where game_id = old.game_id;
delete from game_chat where game_id = old.game_id;
delete from game_replay where game_id = old.game_id;
+ delete from game_snap where game_id = old.game_id;
delete from game_notes where game_id = old.game_id;
delete from last_notified where game_id = old.game_id;
delete from unread_chats where game_id = old.game_id;