Skip to content
Henry Pan edited this page Mar 30, 2021 · 5 revisions

Schema

users

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

tracks

column name data type details
id integer not null, primary key
title string not null, indexed
description text optional
plays integer not null, default: 0
uploader_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • uploader_id references users
  • index on title
  • index on uploader_id
  • index on [:title, :uploader_id], unique: true

comments

column name data type details
id integer not null, primary key
comment_body text not null
commenter_id integer not null, indexed, foreign key
track_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • commenter_id references users
  • track_id references tracks
  • index on commenter_id
  • index on track_id

Clone this wiki locally