Skip to content

Commit

Permalink
fix: add additional column to teams table, allow multiple run of schema
Browse files Browse the repository at this point in the history
  • Loading branch information
SkellyBG committed Feb 24, 2024
1 parent aa2533a commit 953ba07
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,35 @@ SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP TABLE IF EXISTS public.teams;
DROP TABLE IF EXISTS public.players;
DROP TABLE IF EXISTS public.puzzles;
DROP TABLE IF EXISTS public.submission;

CREATE TABLE IF NOT EXISTS public.teams (
CREATE TABLE public.teams (
team_name text PRIMARY KEY,
team_channel text NOT NULL,
category_channel_id text NOT NULL,
voice_channel_id text NOT NULL,
text_channel_id text NOT NULL,
team_role_id text NOT NULL,
puzzle_solved integer NOT NULL default 0
);

CREATE TABLE IF NOT EXISTS public.players (
CREATE TABLE public.players (
discord_id text PRIMARY KEY,
player_name text NOT NULL,
team_name text NOT NULL REFERENCES public.teams ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS public.puzzles (
CREATE TABLE public.puzzles (
puzzle_id text PRIMARY KEY,
puzzle_name text NOT NULL,
puzzle_answer text NOT NULL,
puzzle_author text NOT NULL,
uni text NOT NULL
);

CREATE TABLE IF NOT EXISTS public.submissions (
CREATE TABLE public.submissions (
puzzle_id text NOT NULL REFERENCES public.puzzles ON DELETE CASCADE,
team_name text NOT NULL REFERENCES public.teams ON DELETE CASCADE,
submission_time timestamptz NOT NULL,
Expand Down

0 comments on commit 953ba07

Please sign in to comment.