Database Schema - R-S-W/Resound GitHub Wiki

Users

Column Name Datatype 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 Timestamp not null
updated_at Timestamp not null
  • index on username, unique: true
  • index on email, unique:true
  • index on session_token, unique:true
  • user has many songs, and albums

Songs

Column Name Datatype Details
id Integer not null, primary key
name String not null, indexed, unique
length Integer
info String
album_id String
artist_id Integer not null, foreign key
created_at Timestamp not null
updated_at Timestamp not null
  • index on name
  • belongs to artist_id, referencing user
  • belongs to album
  • has many comments

Comments

Column Name Datatype Details
id Integer not null, primary key
content String not null
user_id Integer not null, foreign_key
song_id Integer not null, foreign_key
  • belongs to song
  • belongs to user

Albums

Column Name Datatype Details
id Integer not null, primary key
name String not null
  • has many songs
  • index for album name