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; DROP TABLE IF EXISTS endgames;
CREATE TABLE endgames ( CREATE TABLE endgames (
game_id INTEGER NOT NULL REFERENCES games (id), game_id INTEGER REFERENCES games (id),
turn SMALLINT NOT NULL, turn SMALLINT,
/** /**
* We want to be able to store probabilities for different actions that can be taken. * 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_type SMALLINT CHECK (0 <= action_type AND action_type <= 2),
action_target SMALLINT NOT NULL, suit_index SMALLINT, /* 0 for clue actions */
enumerator INTEGER NOT NULL, rank SMALLINT, /* 0 for clue actions */
denominator INTEGER NOT NULL, enumerator INTEGER NOT NULL CHECK (enumerator >= 0),
PRIMARY KEY (game_id, turn, action_type, action_target) denominator INTEGER NOT NULL CHECK (denominator > 0),
PRIMARY KEY (game_id, turn, action_type, suit_index, rank)
); );