Skip to content

Commit

Permalink
fix(db): only allow limited values in curr_round
Browse files Browse the repository at this point in the history
  • Loading branch information
BastiDood committed Jul 12, 2024
1 parent f2d1020 commit 4076bbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion postgres/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ CREATE SCHEMA drap
)
CREATE TABLE drafts (
draft_id BIGINT GENERATED ALWAYS AS IDENTITY NOT NULL PRIMARY KEY,
curr_round SMALLINT NOT NULL DEFAULT 0 CONSTRAINT curr_round_above_floor CHECK (curr_round >= 0),
curr_round SMALLINT NOT NULL DEFAULT 0,
max_rounds SMALLINT NOT NULL CONSTRAINT max_rounds_above_floor CHECK (max_rounds > 0),
active_period TSTZRANGE NOT NULL DEFAULT TSTZRANGE '[now,)',
CONSTRAINT curr_round_within_bounds CHECK (curr_round BETWEEN 0 AND max_rounds + 1),
CONSTRAINT overlapping_draft_periods EXCLUDE USING gist (active_period WITH &&)
)
CREATE TABLE student_ranks (
Expand Down

0 comments on commit 4076bbc

Please sign in to comment.