Skip to content

Commit

Permalink
sql
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline committed Apr 26, 2024
1 parent c1c25fb commit 9e424e7
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions rose/cache.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -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,
Expand Down

0 comments on commit 9e424e7

Please sign in to comment.