2024-08-25 17:43:55 +02:00
|
|
|
CREATE TABLE app_flags_games (
|
|
|
|
game_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
|
|
game_seed UUID DEFAULT gen_random_uuid(),
|
|
|
|
uid VARCHAR DEFAULT NULL,
|
|
|
|
tags VARCHAR[] NOT NULL,
|
|
|
|
question_amount INT NOT NULL,
|
2024-08-26 14:22:24 +02:00
|
|
|
question_current INT DEFAULT 1 NOT NULL,
|
2024-08-26 16:46:28 +02:00
|
|
|
questions_errors INT DEFAULT 0 NOT NULL,
|
2024-08-25 17:43:55 +02:00
|
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
|
|
last_activity TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
|
|
FOREIGN KEY (uid) REFERENCES users (uid)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE app_flags_games_answers (
|
2024-08-26 00:18:45 +02:00
|
|
|
game_id UUID NOT NULL,
|
2024-08-25 17:43:55 +02:00
|
|
|
question INT NOT NULL,
|
2024-08-26 14:22:24 +02:00
|
|
|
errors INT NOT NULL,
|
2024-08-25 17:43:55 +02:00
|
|
|
FOREIGN KEY (game_id) REFERENCES app_flags_games (game_id),
|
|
|
|
CONSTRAINT app_flags_games_answers_unique UNIQUE (game_id, question)
|
|
|
|
);
|
|
|
|
|