From 25cfd06f1bf74ccd84f34ebfd82ca26e91a806f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 12 Jan 2024 20:20:23 +0100 Subject: [PATCH] change database format --- install/database_schema.sql | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/install/database_schema.sql b/install/database_schema.sql index fb66f2a..f8f73a9 100644 --- a/install/database_schema.sql +++ b/install/database_schema.sql @@ -363,15 +363,19 @@ CREATE TABLE user_statistics ( DROP TABLE IF EXISTS endgames; CREATE TABLE endgames ( - game_id INTEGER NOT NULL REFERENCES games (id), - turn SMALLINT NOT NULL, + game_id INTEGER REFERENCES games (id), + turn SMALLINT, /** * We want to be able to store probabilities for different actions that can be taken. - * We use the same encoding as in the game_actions table, except that for clues, we do not store values. + * Action type can be + 0 for play actions + 1 for discard actions + 2 for clues */ - action_type SMALLINT NOT NULL, - action_target SMALLINT NOT NULL, - enumerator INTEGER NOT NULL, - denominator INTEGER NOT NULL, - PRIMARY KEY (game_id, turn, action_type, action_target) + action_type SMALLINT CHECK (0 <= action_type AND action_type <= 2), + suit_index SMALLINT, /* 0 for clue actions */ + rank SMALLINT, /* 0 for clue actions */ + enumerator INTEGER NOT NULL CHECK (enumerator >= 0), + denominator INTEGER NOT NULL CHECK (denominator > 0), + PRIMARY KEY (game_id, turn, action_type, suit_index, rank) ); \ No newline at end of file