diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-10 14:41:29 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-13 14:10:20 +0200 |
commit | 66f983b8c9bfe547835741fd93d003d56ddea186 (patch) | |
tree | b72e8a1260a6b163e24e03cedf076fbdf19efae9 | |
parent | 9a455686c7e71e71fa84514760e9fb3202da1ca7 (diff) | |
download | server-66f983b8c9bfe547835741fd93d003d56ddea186.tar.gz |
Add trigger to prune game data when archiving a game.
-rw-r--r-- | schema.sql | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -439,6 +439,20 @@ create view your_turn as and active in ('All', 'Both', role) ; +-- Trigger to remove game data when filing a game as archived + +drop trigger if exists trigger_archive_game; +create trigger trigger_archive_game after update on games when new.status = 3 +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; +end; + -- Triggers to clean up without relying on foreign key cascades drop trigger if exists trigger_delete_on_games; |