summaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-10-05 16:18:59 +0200
committerTor Andersson <tor@ccxvii.net>2022-10-05 17:36:50 +0200
commitd599d78732c0e7b312e6e366c27577a45edf856e (patch)
tree4f4f7a84a568304a24b8249e113e1f2236113d34 /schema.sql
parenta7a26d847be77d0c9007b3e9766a83cfa3b34876 (diff)
downloadserver-d599d78732c0e7b312e6e366c27577a45edf856e.tar.gz
Track read status of in-game chat messages.
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql8
1 files changed, 8 insertions, 0 deletions
diff --git a/schema.sql b/schema.sql
index 6ee8388..dee4356 100644
--- a/schema.sql
+++ b/schema.sql
@@ -244,6 +244,12 @@ create table if not exists game_chat (
message text
);
+create table if not exists unread_chats (
+ user_id integer,
+ game_id integer,
+ primary key (user_id, game_id)
+) without rowid;
+
drop view if exists game_chat_view;
create view game_chat_view as
select
@@ -379,6 +385,7 @@ begin
delete from game_chat where game_id = old.game_id;
delete from game_replay 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;
delete from players where game_id = old.game_id;
end;
@@ -390,6 +397,7 @@ begin
delete from user_last_seen where user_id = old.user_id;
delete from last_notified where user_id = old.user_id;
delete from read_threads where user_id = old.user_id;
+ delete from unread_chats where user_id = old.user_id;
delete from contacts where me = old.user_id or you = old.user_id;
delete from messages where from_id = old.user_id or to_id = old.user_id;
delete from posts where author_id = old.user_id;