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,17 +31,19 @@ CREATE INDEX games_var_seed_idx ON games (variant_id, seed);
|
||||||
CREATE INDEX games_player_idx ON games (num_players);
|
CREATE INDEX games_player_idx ON games (num_players);
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS infeasibility_certs;
|
DROP TABLE IF EXISTS score_upper_bounds;
|
||||||
CREATE TABLE infeasibility_certs (
|
CREATE TABLE score_upper_bounds (
|
||||||
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
||||||
score_upper_bound SMALLINT NOT NULL,
|
score_upper_bound SMALLINT NOT NULL,
|
||||||
reason SMALLINT NOT NULL
|
reason SMALLINT NOT NULL,
|
||||||
|
UNIQUE (seed, reason)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS feasibility_certs;
|
DROP TABLE IF EXISTS score_lower_bounds;
|
||||||
CREATE TABLE feasibility_certs (
|
CREATE TABLE score_lower_bounds (
|
||||||
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
seed TEXT NOT NULL REFERENCES seeds ON DELETE CASCADE,
|
||||||
game_id INT REFERENCES games ON DELETE CASCADE,
|
score_lower_bound SMALLINT NOT NULL,
|
||||||
actions TEXT,
|
game_id INT REFERENCES games ON DELETE CASCADE,
|
||||||
|
actions TEXT,
|
||||||
CHECK (num_nonnulls(game_id, actions) = 1)
|
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 = "
|
database.cur.execute("UPDATE seeds SET (feasible, max_score_theoretical) = (%s, %s) WHERE seed = "
|
||||||
"(%s)", (True, variant.max_score, seed))
|
"(%s)", (True, variant.max_score, seed))
|
||||||
database.cur.execute(
|
database.cur.execute(
|
||||||
"INSERT INTO feasibility_certs (seed, game_id) VALUES (%s, %s)",
|
"INSERT INTO score_lower_bounds (seed, score_lower_bound, game_id) VALUES (%s, %s, %s)",
|
||||||
(seed, game_id)
|
(seed, variant.max_score, game_id)
|
||||||
)
|
)
|
||||||
database.conn.commit()
|
database.conn.commit()
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue