summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-11-21 19:44:15 +0100
committerTor Andersson <tor@ccxvii.net>2021-11-21 19:44:15 +0100
commitc6908c035c61820e643580f1f06c052af8b71a1e (patch)
tree2c091a760c44adc2899ee60956e3702f6a7473f9 /tools
parent18f196400352eb8c0bb6f6dd30890b8cc272ad15 (diff)
downloadserver-c6908c035c61820e643580f1f06c052af8b71a1e.tar.gz
Add your_turn SQL view.
Diffstat (limited to 'tools')
-rw-r--r--tools/sql/schema.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/sql/schema.txt b/tools/sql/schema.txt
index dc2bcc6..a7cb6bb 100644
--- a/tools/sql/schema.txt
+++ b/tools/sql/schema.txt
@@ -246,6 +246,15 @@ CREATE VIEW your_turn_reminder AS
AND datetime('now') > datetime(mtime, '+1 hour')
;
+DROP VIEW IF EXISTS your_turn;
+CREATE VIEW your_turn AS
+ SELECT game_id, user_id, role
+ FROM players
+ JOIN games USING(game_id)
+ JOIN game_state USING(game_id)
+ WHERE status=1 AND active IN ( 'All', 'Both', role )
+ ;
+
DROP TRIGGER IF EXISTS no_part_on_active_game;
CREATE TRIGGER no_part_on_active_game BEFORE DELETE ON players
BEGIN