Add "NOT NULL" constraints to database columns
parent
f2085ec0f2
commit
238a22e597
|
@ -55,8 +55,8 @@ CREATE TABLE IF NOT EXISTS scores.sports(
|
|||
CREATE TABLE IF NOT EXISTS scores.divisions(
|
||||
division_id BIGINT GENERATED ALWAYS AS IDENTITY,
|
||||
division_name TEXT NOT NULL,
|
||||
gender VARCHAR(1) CHECK (gender IN ( 'F', 'M' ) ),
|
||||
sport_id BIGINT,
|
||||
gender VARCHAR(1) NOT NULL CHECK (gender IN ( 'F', 'M' ) ),
|
||||
sport_id BIGINT NOT NULL,
|
||||
currently_active BOOLEAN DEFAULT TRUE,
|
||||
PRIMARY KEY(division_id),
|
||||
CONSTRAINT fk_sport
|
||||
|
@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS scores.divisions(
|
|||
CREATE TABLE IF NOT EXISTS scores.teams(
|
||||
team_id BIGINT GENERATED ALWAYS AS IDENTITY,
|
||||
team_name TEXT NOT NULL,
|
||||
sport_id BIGINT,
|
||||
sport_id BIGINT NOT NULL,
|
||||
currently_active BOOLEAN DEFAULT TRUE,
|
||||
PRIMARY KEY(team_id),
|
||||
CONSTRAINT fk_sport
|
||||
|
@ -83,14 +83,14 @@ CREATE TABLE IF NOT EXISTS scores.seasons(
|
|||
|
||||
CREATE TABLE IF NOT EXISTS scores.games(
|
||||
game_id BIGINT GENERATED ALWAYS AS IDENTITY,
|
||||
division_id BIGINT,
|
||||
season_id BIGINT,
|
||||
game_date DATE,
|
||||
team1_id BIGINT,
|
||||
team2_id BIGINT,
|
||||
team1_score INTEGER,
|
||||
team2_score INTEGER,
|
||||
submitter_id BIGINT,
|
||||
division_id BIGINT NOT NULL,
|
||||
season_id BIGINT NOT NULL,
|
||||
game_date DATE NOT NULL,
|
||||
team1_id BIGINT NOT NULL,
|
||||
team2_id BIGINT NOT NULL,
|
||||
team1_score INTEGER NOT NULL,
|
||||
team2_score INTEGER NOT NULL,
|
||||
submitter_id BIGINT NOT NULL,
|
||||
updated_timestamp TIMESTAMP WITH TIME ZONE DEFAULT now(),
|
||||
PRIMARY KEY(game_id),
|
||||
CONSTRAINT fk_division
|
||||
|
|
Reference in New Issue