From 9e424e77c5ad8e3f1500d6042f8d39b24f44b50b Mon Sep 17 00:00:00 2001 From: blissful Date: Fri, 26 Apr 2024 13:58:30 -0400 Subject: [PATCH] sql --- rose/cache.sql | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/rose/cache.sql b/rose/cache.sql index 2384066..34c9441 100644 --- a/rose/cache.sql +++ b/rose/cache.sql @@ -15,11 +15,11 @@ CREATE TABLE releases ( title TEXT NOT NULL, releasetype TEXT NOT NULL, releaseyear INTEGER, + originalyear INTEGER, compositionyear INTEGER, catalognumber TEXT, disctotal INTEGER NOT NULL, - -- A sha256() of the release object, which can be used as a performant cache - -- key. + -- A sha256 of the release object, which can be used as a performant cache key. metahash TEXT NOT NULL UNIQUE, new BOOLEAN NOT NULL DEFAULT true ); @@ -36,6 +36,26 @@ CREATE TABLE releases_genres ( CREATE INDEX releases_genres_release_id_position ON releases_genres(release_id, position); CREATE INDEX releases_genres_genre ON releases_genres(genre); +CREATE TABLE releases_secondary_genres ( + release_id TEXT REFERENCES releases(id) ON DELETE CASCADE, + genre TEXT, + position INTEGER NOT NULL, + PRIMARY KEY (release_id, genre), + UNIQUE (release_id, position) +); +CREATE INDEX releases_secondary_genres_release_id_position ON releases_secondary_genres(release_id, position); +CREATE INDEX releases_secondary_genres_genre ON releases_secondary_genres(genre); + +CREATE TABLE releases_descriptors ( + release_id TEXT REFERENCES releases(id) ON DELETE CASCADE, + descriptor TEXT, + position INTEGER NOT NULL, + PRIMARY KEY (release_id, descriptor), + UNIQUE (release_id, position) +); +CREATE INDEX releases_descriptors_release_id_position ON releases_descriptors(release_id, position); +CREATE INDEX releases_descriptors_descriptor ON releases_descriptors(descriptor); + CREATE TABLE releases_labels ( release_id TEXT REFERENCES releases(id) ON DELETE CASCADE, label TEXT,