-- Table: public."user" -- DROP TABLE public."user"; CREATE TABLE public."user" ( id serial, username text NOT NULL, password character varying, CONSTRAINT user_pkey PRIMARY KEY (id) ); -- Index: user_lower_idx -- DROP INDEX public.user_lower_idx; CREATE UNIQUE INDEX user_lower_idx ON public."user" (lower(username)); -- Table: public.panel -- DROP TABLE public.panel; CREATE TABLE public.panel ( id serial, name text NOT NULL, article text NOT NULL, CONSTRAINT panel_pkey PRIMARY KEY (id) ); -- Table: public.user_panel -- DROP TABLE public.user_panel; CREATE TABLE public.user_panel ( user_id integer NOT NULL, panel_id integer NOT NULL, CONSTRAINT user_panel_pkey PRIMARY KEY (user_id, panel_id), CONSTRAINT panel_id FOREIGN KEY (user_id) REFERENCES public.panel (id), CONSTRAINT user_id FOREIGN KEY (user_id) REFERENCES public."user" (id) ); -- Table: public.round -- DROP TABLE public.round; CREATE TABLE public.round ( id serial, start timestamp with time zone NOT NULL, "end" timestamp with time zone NOT NULL, panel_id integer NOT NULL, section text NOT NULL, CONSTRAINT round_pkey PRIMARY KEY (id), CONSTRAINT panel_id FOREIGN KEY (panel_id) REFERENCES public.panel (id) ); -- Table: public.entry -- DROP TABLE public.entry; CREATE TABLE public.entry ( user_id integer NOT NULL, round_id integer NOT NULL, artist text, title text, spotify_url text, synced boolean NOT NULL DEFAULT false, CONSTRAINT entry_pkey PRIMARY KEY (user_id, round_id) );