summaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-21 11:53:02 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-23 01:48:09 +0200
commitbd6644214c757a08c1c533048352a902fdefe4ae (patch)
tree6f511e147ab648dee286afd2d79c79b9ba18267b /schema.sql
parent649fcc09f6addf06dda10862a0f8ff5da19d536e (diff)
downloadserver-bd6644214c757a08c1c533048352a902fdefe4ae.tar.gz
Improve replay id handling.
Use a without rowid table and create the replay_id dynamically. This saves a lot of database space and performance as it removes the need for a separate index.
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql9
1 files changed, 4 insertions, 5 deletions
diff --git a/schema.sql b/schema.sql
index e685e3b..95e2690 100644
--- a/schema.sql
+++ b/schema.sql
@@ -318,14 +318,13 @@ create view game_chat_view as
create index if not exists game_chat_idx on game_chat(game_id);
create table if not exists game_replay (
- replay_id integer primary key,
game_id integer,
+ replay_id integer,
role text,
action text,
- arguments json -- numeric affinity is more compact for numbers
-);
-
-create index if not exists game_replay_idx on game_replay(game_id);
+ arguments json, -- numeric affinity is more compact for numbers
+ primary key (game_id, replay_id)
+) without rowid;
create table if not exists game_notes (
game_id integer,