introduce endgames table

This commit is contained in:
Maximilian Keßler 2024-01-09 15:10:15 +01:00
parent 4e459c4888
commit d717a9df36
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -359,3 +359,19 @@ CREATE TABLE user_statistics (
average_game_moves REAL GENERATED ALWAYS AS (CASE WHEN games_played != 0 THEN CAST(total_game_moves AS REAL) / games_played ELSE NULL END) STORED, average_game_moves REAL GENERATED ALWAYS AS (CASE WHEN games_played != 0 THEN CAST(total_game_moves AS REAL) / games_played ELSE NULL END) STORED,
PRIMARY KEY (user_id, variant_type) PRIMARY KEY (user_id, variant_type)
); );
DROP TABLE IF EXISTS endgames;
CREATE TABLE endgames (
game_id INTEGER NOT NULL REFERENCES games (id),
turn SMALLINT NOT NULL,
/**
* 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 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)
);