started new Databse Schematic

This commit is contained in:
Lars Noack 2022-12-02 10:12:39 +01:00
parent e883469ad7
commit 8e1fd8ba5e

View File

@ -0,0 +1,58 @@
CREATE TABLE Song
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
name TEXT
);
CREATE TABLE Source
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
song_id BIGINT,
FOREIGN KEY(song_id) REFERENCES Song(id)
);
CREATE TABLE Target
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
song_id BIGINT,
FOREIGN KEY(song_id) REFERENCES Song(id)
);
CREATE TABLE Lyrics
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
song_id BIGINT,
FOREIGN KEY(song_id) REFERENCES Song(id)
);
CREATE TABLE Artist
(
id INTEGER AUTO_INCREMENT PRIMARY KEY,
name TEXT
);
CREATE TABLE Album
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
song_id BIGINT,
FOREIGN KEY(song_id) REFERENCES Song(id)
);
CREATE TABLE SongArtist
(
song_id BIGINT,
artist_id INTEGER,
FOREIGN KEY(song_id) REFERENCES Song(id),
FOREIGN KEY(artist_id) REFERENCES Artist(id)
);
CREATE TABLE AlbumArtist
(
album_id BIGINT,
artist_id INTEGER,
FOREIGN KEY(album_id) REFERENCES Album(id),
FOREIGN KEY(artist_id) REFERENCES Artist(id)
);