added stuff, broke some other stuff, made admin auth!
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
0d1e694b59
commit
5631c4bd87
26 changed files with 1615 additions and 1401 deletions
52
schema.sql
Normal file
52
schema.sql
Normal file
|
@ -0,0 +1,52 @@
|
|||
CREATE TABLE IF NOT EXISTS artists (
|
||||
id text NOT NULL,
|
||||
name text,
|
||||
website text
|
||||
);
|
||||
ALTER TABLE artists ADD CONSTRAINT artists_pk PRIMARY KEY (id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS musicreleases (
|
||||
id character varying(64) NOT NULL,
|
||||
title text NOT NULL,
|
||||
type text,
|
||||
release_date DATE NOT NULL,
|
||||
artwork text,
|
||||
buyname text,
|
||||
buylink text
|
||||
);
|
||||
ALTER TABLE musicreleases ADD CONSTRAINT musicreleases_pk PRIMARY KEY (id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS musiclinks (
|
||||
release character varying(64) NOT NULL,
|
||||
name text NOT NULL,
|
||||
url text,
|
||||
);
|
||||
ALTER TABLE musiclinks ADD CONSTRAINT musiclinks_pk PRIMARY KEY (release, name);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS musiccredits (
|
||||
release character varying(64) NOT NULL,
|
||||
artist text NOT NULL,
|
||||
role text,
|
||||
is_primary boolean,
|
||||
);
|
||||
ALTER TABLE musiccredits ADD CONSTRAINT musiccredits_pk PRIMARY KEY (release, artist);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS musictracks (
|
||||
release character varying(64) NOT NULL,
|
||||
number integer NOT NULL,
|
||||
title text NOT NULL,
|
||||
description text,
|
||||
lyrics text,
|
||||
preview_url text,
|
||||
);
|
||||
ALTER TABLE musictracks ADD CONSTRAINT musictracks_pk PRIMARY KEY (release, number);
|
||||
|
||||
-- foreign keys
|
||||
|
||||
ALTER TABLE public.musiccredits ADD CONSTRAINT musiccredits_artist_fk FOREIGN KEY (artist) REFERENCES public.artists(id) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE public.musiccredits ADD CONSTRAINT musiccredits_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE public.musiclinks ADD CONSTRAINT musiclinks_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE public.musictracks ADD CONSTRAINT musictracks_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON DELETE CASCADE;
|
Loading…
Add table
Add a link
Reference in a new issue