Schema - lisuzanne94/soundCRUD GitHub Wiki

Postgres Database Schema

users

column name data type details
id integer not null, primary key
username 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 session_token, unique: true

tracks

column name data type details
id integer not null, primary key
title string not null, indexed
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

comments

column name data type details
id integer not null, primary key
body string 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