DB: add schemas for lower and upper bounds on score
This commit is contained in:
parent
98bbe02495
commit
91f3c73eb3
2 changed files with 12 additions and 10 deletions
|
@ -31,16 +31,18 @@ CREATE INDEX games_var_seed_idx ON games (variant_id, seed);
|
|||
CREATE INDEX games_player_idx ON games (num_players);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS infeasibility_certs;
|
||||
CREATE TABLE infeasibility_certs (
|
||||
DROP TABLE IF EXISTS score_upper_bounds;
|
||||
CREATE TABLE score_upper_bounds (
|
||||
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
||||
score_upper_bound SMALLINT NOT NULL,
|
||||
reason SMALLINT NOT NULL
|
||||
reason SMALLINT NOT NULL,
|
||||
UNIQUE (seed, reason)
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS feasibility_certs;
|
||||
CREATE TABLE feasibility_certs (
|
||||
DROP TABLE IF EXISTS score_lower_bounds;
|
||||
CREATE TABLE score_lower_bounds (
|
||||
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
||||
score_lower_bound SMALLINT NOT NULL,
|
||||
game_id INT REFERENCES games ON DELETE CASCADE,
|
||||
actions TEXT,
|
||||
CHECK (num_nonnulls(game_id, actions) = 1)
|
||||
|
|
|
@ -56,8 +56,8 @@ def update_trivially_feasible_games(variant_id):
|
|||
database.cur.execute("UPDATE seeds SET (feasible, max_score_theoretical) = (%s, %s) WHERE seed = "
|
||||
"(%s)", (True, variant.max_score, seed))
|
||||
database.cur.execute(
|
||||
"INSERT INTO feasibility_certs (seed, game_id) VALUES (%s, %s)",
|
||||
(seed, game_id)
|
||||
"INSERT INTO score_lower_bounds (seed, score_lower_bound, game_id) VALUES (%s, %s, %s)",
|
||||
(seed, variant.max_score, game_id)
|
||||
)
|
||||
database.conn.commit()
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue