Schema Version 1.4 (Collections)

Added Collections for Art
Added art_collections for assigning art to collections
master
Peery 3 years ago
parent 274d2733f9
commit d91dc4aa30

@ -1,12 +1,13 @@
-- Creating the DB structure
-- Version 1.3 (2021-08-14)
-- Version 1.4 (2021-10-10)
CREATE TABLE IF NOT EXISTS Art (
ID INTEGER PRIMARY KEY generated always as identity,
md5_hash CHAR(32) NOT NULL UNIQUE,
path VARCHAR NOT NULL UNIQUE,
title VARCHAR,
link VARCHAR
link VARCHAR,
description VARCHAR
);
CREATE TABLE IF NOT EXISTS Artist (
@ -29,6 +30,21 @@ CREATE TABLE IF NOT EXISTS Presence (
FOREIGN KEY (artist_ID) REFERENCES Artist(ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS Collection ( -- for ordered lists of art
ID INTEGER PRIMARY KEY generated always as identity,
name VARCHAR,
description VARCHAR
);
CREATE TABLE IF NOT EXISTS Art_Collection (
collection_ID INTEGER NOT NULL,
art_ID INTEGER NOT NULL,
ranking VARCHAR, -- order in the collection by string value, allows easy insert see https://stackoverflow.com/questions/9536262/best-representation-of-an-ordered-list-in-a-database; same rank or empty rank means unordered
PRIMARY KEY (collection_ID, art_ID),
FOREIGN KEY (collection_ID) REFERENCES Collection(ID) ON DELETE CASCADE,
FOREIGN KEY (art_ID) REFERENCES Art(ID)
);
CREATE TABLE IF NOT EXISTS Art_Author (
presence_name CHAR(20) NOT NULL,
presence_domain CHAR(20) NOT NULL,
@ -88,7 +104,7 @@ GRANT CONNECT ON
DATABASE artnet
TO artnet_editor;
GRANT SELECT, INSERT, UPDATE, DELETE ON
TABLE art, art_author, tag_category, art_tag, artist_topic, artist, presence, tag, tag_alias, tag_implication, topic
TABLE art, art_author, tag_category, art_tag, artist_topic, artist, presence, tag, tag_alias, tag_implication, topic, collection, art_collection
TO artnet_editor;
GRANT USAGE ON

Loading…
Cancel
Save