initial setup, messing around with sqlc
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id UUID PRIMARY KEY,
|
||||
user_name VARCHAR(255) NOT NULL,
|
||||
user_mail VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS albums (
|
||||
id UUID PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
artist VARCHAR(255) NOT NULL,
|
||||
release_date DATE,
|
||||
album_art_url VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS artists (
|
||||
id UUID PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
genre VARCHAR(255),
|
||||
bio TEXT,
|
||||
artist_image_url VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_albums (
|
||||
user_id UUID,
|
||||
album_id UUID,
|
||||
album_owned BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
album_want BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
is_vinyl BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
is_cd BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (user_id, album_id),
|
||||
FOREIGN KEY (user_id) REFERENCES Users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE
|
||||
);
|
||||
Reference in New Issue
Block a user