Skip to content
Timothy Chang edited this page Jan 27, 2023 · 28 revisions

Postgres Database Schema

Users

column name data type details
id bigint not null, primary key
username string not null, indexed, unique
password_digest string not null
email string not null, indexed, unique
name string not null
birth_date string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null

Songs

Playlists

column name data type details
id bigint not null, primary key
author_id integer not null, indexed, foreign key
title string not null, indexed
public boolean not null
created_at datetime not null
updated_at datetime not null

Likes

column name data type details
id bigint not null, primary key
liker_id integer not null, foreign key, indexed
media_id integer not null, foreign key, indexed
media_type string not null
created_at datetime not null
updated_at datetime not null

Artists

Albums

column name data type details
id bigint not null, primary key
title string not null, indexed
artist_id integer not null, foreign key, indexed
published_date string not null
created_at datetime not null
updated_at datetime not null

Clone this wiki locally