first db schema gen

This commit is contained in:
2025-04-13 18:15:22 -05:00
parent d4473f98b6
commit 0bbd1b2bca
16 changed files with 147 additions and 12 deletions
@@ -0,0 +1,4 @@
CREATE TABLE artist_credit (
id int PRIMARY KEY,
text string NOT NULL
);
@@ -0,0 +1,5 @@
CREATE TABLE artist_credit_artist (
id int PRIMARY KEY,
FOREIGN KEY(artist_id) REFERENCES artists(id),
FOREIGN KEY(credit_id) REFERENCES artist_credit(id)
);
+1 -1
View File
@@ -1,4 +1,4 @@
CREATE TABLE artists (
id INTEGER PRIMARY KEY,
id int PRIMARY KEY,
name text NOT NULL
);
+5 -4
View File
@@ -1,6 +1,7 @@
CREATE TABLE audio_files (
id uuid PRIMARY KEY,
file_path text NOT NULL,
file_type text NOT NULL,
length_seconds int NOT NULL
id int PRIMARY KEY,
file_path text NOT NULL UNIQUE,
length_milliseconds int NOT NULL,
FOREIGN KEY(file_type_id) REFERENCES file_types(id),
FOREIGN KEY(recording_id) REFERENCES recordings(id)
);
@@ -0,0 +1,6 @@
CREATE TABLE cover_art (
id int PRIMARY KEY,
is_embedded bool NOT NULL DEFAULT(false),
file_path text NOT NULL,
FOREIGN KEY(file_type_id) REFERENCES file_types(id)
);
+1 -1
View File
@@ -1,4 +1,4 @@
CREATE TABLE file_types (
id INTEGER PRIMARY KEY,
extension text NOT NULL
extension text NOT NULL UNIQUE
);
+3 -2
View File
@@ -1,5 +1,6 @@
CREATE TABLE recordings (
id INTEGER PRIMARY KEY,
name text NOT NULL
id int PRIMARY KEY,
name text NOT NULL,
FOREIGN KEY(artist_credit_id) REFERENCES artist_credit(id)
);
@@ -0,0 +1,6 @@
CREATE TABLE release_group_recordings (
id int PRIMARY KEY,
FOREIGN KEY(release_group_id) REFERENCES release_groups(id),
FOREIGN KEY(recording_id) REFERENCES recordings(id)
);
@@ -1,4 +1,5 @@
CREATE TABLE release_groups (
id INTEGER PRIMARY KEY,
name text NOT NULL
id int PRIMARY KEY,
name text NOT NULL,
FOREIGN KEY(cover_art_id) REFERENCES cover_art(id)
);