diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-10-03 16:30:13 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-10-05 17:36:50 +0200 |
commit | f972745ac092a1657d40d9fb01f7c68508a7c416 (patch) | |
tree | cf4d51b2d496f397f16aa5d1eedcc6219dc239b5 /schema.sql | |
parent | d214832a193a06f20612fcfb3e64f86562235b70 (diff) | |
download | server-f972745ac092a1657d40d9fb01f7c68508a7c416.tar.gz |
Add contact list with friends and blacklisted users.
Diffstat (limited to 'schema.sql')
-rw-r--r-- | schema.sql | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -79,6 +79,31 @@ create view user_profile_view as natural left join user_last_seen ; +-- Friend and Block Lists -- + +create table if not exists contacts ( + me integer, + you integer, + relation integer, + primary key (me, you) +) without rowid; + +drop view if exists contact_view; +create view contact_view as + select + contacts.me, + users.user_id, + users.name, + user_last_seen.atime, + contacts.relation + from + contacts + left join users on contacts.you = users.user_id + left join user_last_seen on contacts.you = user_last_seen.user_id + order by + users.name +; + -- Messages -- create table if not exists messages ( @@ -229,7 +254,7 @@ create table if not exists game_replay ( game_id integer, role text, action text, - arguments text + arguments json -- numeric affinity is more compact for numbers ); create index if not exists game_replay_idx on game_replay(game_id); @@ -358,6 +383,7 @@ begin delete from tokens where user_id = old.user_id; delete from user_last_seen where user_id = old.user_id; delete from last_notified 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; delete from threads where author_id = old.user_id; |