change database format

This commit is contained in:
Maximilian Keßler 2024-01-12 20:20:23 +01:00
parent d717a9df36
commit 25cfd06f1b
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -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)
);