diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-09-29 01:36:11 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-03 14:01:03 +0200 |
commit | 036babec3e9f93822b808a7a62dcf9485ddf3307 (patch) | |
tree | 1ca729605a7642ca8262a35e0a62160fa549d146 /schema.sql | |
parent | 2accdc5d90093bff1e1d7c19d2afc80db603f7bf (diff) | |
download | server-036babec3e9f93822b808a7a62dcf9485ddf3307.tar.gz |
Be more robust when deleting accounts.
Leave player assignment to not mess with Elo ratings and tournament data.
Reset ctime when game is actually started.
Diffstat (limited to 'schema.sql')
-rw-r--r-- | schema.sql | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -177,7 +177,7 @@ create view rating_view as title_id, name, rating, count, last from ratings - join users using(user_id) + left join users using(user_id) order by title_id, rating desc @@ -499,7 +499,7 @@ create view player_view as from games join players using(game_id) - join users using(user_id) + left join users using(user_id) left join user_last_seen using(user_id) ; @@ -538,7 +538,7 @@ create view game_export_view as json_object('role', role, 'name', name) ) from players - join users using(user_id) + left join users using(user_id) where game_id = outer.game_id ), 'state', @@ -683,9 +683,7 @@ begin delete from posts where author_id = old.user_id; delete from threads where author_id = old.user_id; delete from game_chat where user_id = old.user_id; - delete from ratings where user_id = old.user_id; - delete from players where user_id = old.user_id and game_id in (select game_id from games where status <= 1); - update players set user_id = 0 where user_id = old.user_id; + delete from players where user_id = old.user_id and game_id in (select game_id from games where status = 0); update games set owner_id = 0 where owner_id = old.user_id; end; |