1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- -- 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)
- );
-
-
- -- Table: public.round_playlist
-
- -- DROP TABLE public.round_playlist;
-
- CREATE TABLE public.round_playlist
- (
- round_id int,
- tracks text[],
- CONSTRAINT round_id FOREIGN KEY (round_id)
- REFERENCES public.round (id)
- );
- ALTER TABLE public.round_playlist
- ADD CONSTRAINT round_id_unique UNIQUE(round_id);
|