@ -3,7 +3,7 @@
CREATE TABLE IF NOT EXISTS Art (
CREATE TABLE IF NOT EXISTS Art (
ID INTEGER PRIMARY KEY generated always as identity ,
ID INTEGER PRIMARY KEY generated always as identity ,
md5_hash CHAR(32 ) NOT NULL UNIQUE ,
md5_hash VAR CHAR NOT NULL UNIQUE ,
path VARCHAR NOT NULL UNIQUE ,
path VARCHAR NOT NULL UNIQUE ,
title VARCHAR ,
title VARCHAR ,
link VARCHAR ,
link VARCHAR ,
@ -17,13 +17,13 @@ CREATE TABLE IF NOT EXISTS Artist (
CREATE TABLE IF NOT EXISTS Topic ( -- as of yet unimplemented, see Art_Topic
CREATE TABLE IF NOT EXISTS Topic ( -- as of yet unimplemented, see Art_Topic
ID INTEGER PRIMARY KEY generated always as identity ,
ID INTEGER PRIMARY KEY generated always as identity ,
name CHAR(20 ) UNIQUE NOT NULL ,
name VAR CHAR UNIQUE NOT NULL ,
description VARCHAR
description VARCHAR
) ;
) ;
CREATE TABLE IF NOT EXISTS Presence (
CREATE TABLE IF NOT EXISTS Presence (
name CHAR(30 ) NOT NULL ,
name VAR CHAR NOT NULL ,
domain CHAR(20 ) NOT NULL ,
domain VAR CHAR NOT NULL ,
link VARCHAR ,
link VARCHAR ,
artist_ID INTEGER NOT NULL ,
artist_ID INTEGER NOT NULL ,
PRIMARY KEY ( name , domain ) ,
PRIMARY KEY ( name , domain ) ,
@ -46,8 +46,8 @@ CREATE TABLE IF NOT EXISTS Art_to_Art_Collection (
) ;
) ;
CREATE TABLE IF NOT EXISTS Art_to_Presence (
CREATE TABLE IF NOT EXISTS Art_to_Presence (
presence_name CHAR(20 ) NOT NULL ,
presence_name VAR CHAR NOT NULL ,
presence_domain CHAR(20 ) NOT NULL ,
presence_domain VAR CHAR NOT NULL ,
art_ID INTEGER NOT NULL ,
art_ID INTEGER NOT NULL ,
PRIMARY KEY ( presence_name , presence_domain , art_ID ) ,
PRIMARY KEY ( presence_name , presence_domain , art_ID ) ,
FOREIGN KEY ( presence_name , presence_domain ) REFERENCES Presence ( name , domain ) ON UPDATE CASCADE ON DELETE CASCADE ,
FOREIGN KEY ( presence_name , presence_domain ) REFERENCES Presence ( name , domain ) ON UPDATE CASCADE ON DELETE CASCADE ,
@ -64,12 +64,12 @@ CREATE TABLE IF NOT EXISTS Artist_to_Topic ( -- TODO implement, meant to indica
CREATE TABLE IF NOT EXISTS Tag_Category (
CREATE TABLE IF NOT EXISTS Tag_Category (
category_id INTEGER PRIMARY KEY generated always as identity ,
category_id INTEGER PRIMARY KEY generated always as identity ,
name CHAR(20 ) NOT NULL
name VAR CHAR NOT NULL
) ;
) ;
CREATE TABLE IF NOT EXISTS Tag (
CREATE TABLE IF NOT EXISTS Tag (
tag_ ID INTEGER PRIMARY KEY generated always as identity ,
ID INTEGER PRIMARY KEY generated always as identity ,
name CHAR(50 ) UNIQUE ,
name VAR CHAR UNIQUE ,
description VARCHAR ,
description VARCHAR ,
category_id SERIAL ,
category_id SERIAL ,
FOREIGN KEY ( category_id ) REFERENCES tag_category ( category_id )
FOREIGN KEY ( category_id ) REFERENCES tag_category ( category_id )