This commit is contained in:
2024-11-01 16:09:16 +01:00
parent 1e7f878a64
commit b2429246e4
10 changed files with 234 additions and 0 deletions

25
sql/create_tables.sql Normal file
View File

@ -0,0 +1,25 @@
CREATE OR REPLACE PROCEDURE create_tables() AS $$
DROP TABLE IF EXISTS artist_website;
DROP TABLE IF EXISTS website;
DROP TABLE IF EXISTS artist;
CREATE TABLE IF NOT EXISTS artist (
id serial PRIMARY KEY,
name text NOT NULL
);
CREATE TABLE IF NOT EXISTS website (
id serial PRIMARY KEY,
name text NOT NULL
);
CREATE TABLE IF NOT EXISTS artist_website (
id serial PRIMARY KEY,
url text NOT NULL,
folder_path text,
website_id integer,
artist_id integer,
CONSTRAINT aw_artist FOREIGN KEY (artist_id) REFERENCES artist (ID),
CONSTRAINT aw_website FOREIGN KEY (website_id) REFERENCES website (ID)
);
$$ LANGUAGE SQL;