Skip to content
Andrew (AJ) Ansel edited this page Sep 19, 2017 · 5 revisions

Users and their features / components

users

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

posts

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

likes

column name data type details
id integer not null, primary key
user_id integer not null, indexed, foreign key
post_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • user_id references users
  • post_id references posts
  • index on [:post_id, :user_id], unique: true

followers

column name data type details
id integer not null, primary key
followee_id integer not null, indexed, foreign key
follower_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • follower_id references users
  • followee_id references users
  • index on [:follower_id, :followee_id], unique: true

Song components (aka songs and artists)

songs

column name data type details
id integer not null, primary key
title string not null
lyrics(aka body) text not null
img_url string not null
artist_id integer not null, indexed, foreign key
album_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • artist_id references artists
  • album_id references albums

artists

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

albums

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

Clone this wiki locally