Schema - Orenshaf/SoundProud GitHub Wiki
Database 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 |
private |
boolean | default: false |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
user_id
referencesusers
- index on
user_id
- index on
genre
comments
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
body |
text | not null |
user_id |
integer | not null, indexed, foreign key |
track_id |
integer | not null, indexed, foreign key |
track_time |
time | not null, foreign key |
parent_cmt_id |
integer | foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
user_id
referencesusers
track_id
referencestracks
- index on
user_id
- index on
track_id
- index on
parent_cmt_id
- dependent on
track
BONUS!
likes
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_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 |
- index on
user_id
- index on
track_id