Database Schema - michellepanzironi/like-a-genius-fullstack GitHub Wiki

Database Schema

Users

column name data type details
id integer not null, primary key
username string not null, unique
email string not null, unique
img_url string not null
password_digest string not null
session_token string not null
created_at datetime not null
updated_at datetime not null
  • index on :username, unique: true
  • index on :email, unique: true

Artists

column name data type details
id integer not null, primary key
name string not null
img_url string
created_at datetime not null
updated_at datetime not null
  • index on name

Albums

column name data type details
id integer not null, primary key
title string not null
artist_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null
  • artist_id references artists
  • index on artist_id
  • index on title

Songs

column name data type details
id integer not null, primary key
title string not null
artist_id integer not null, foreign key
album_id integer not null, foreign key
lyrics string not null
created_at datetime not null
updated_at datetime not null
  • artist_id references artists
  • album_id references albums
  • index on artist_id
  • index on album_id
  • index on title

Annotations

column name data type details
id integer not null, primary key
title string not null
author_id integer not null, foreign key
song_id integer not null, foreign key
body string not null
created_at datetime not null
updated_at datetime not null
  • author_id references artists
  • song_id references songs
  • index on title

Comments

column name data type details
id integer not null, primary key
author_id integer not null, foreign key
song_id integer not null, foreign key
body string not null
created_at datetime not null
updated_at datetime not null
  • author_id references users
  • song_id references songs

Upvotes

column name data type details
id integer not null, primary key
author_id integer not null, foreign key
comment_id integer foreign key
annotation_id integer foreign key
created_at datetime not null
updated_at datetime not null
  • comment_id references comments
  • annotation_id references annotations
⚠️ **GitHub.com Fallback** ⚠️