-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
nramabad edited this page Dec 19, 2018
·
19 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
year |
integer | not null |
genre |
string | not null |
artist_id |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
artist_idreferences theartiststable - indexing on
artist_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
bio |
text | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
polymorphic joins table
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, foreign key |
follow_id |
integer | not null, foreign key |
follow_type |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferences theuserstable - indexing on
[:user_id, :follow_id], unique: true -
followable_idwill reference either the songs, playlists, artists or albums tables based onfollow_type - polymorphic association for followed artists and playlists
joins table
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
song_id |
integer | not null |
playlist_id |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
song_idreferences thesongstable -
playlist_idreferences theplayliststable - indexing on
playlist_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
description |
text | |
user_id |
integer | not null, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferences theuserstable - indexing on
user_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
duration |
integer | not null |
album_id |
integer | not null, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
album_idreferences thealbumstable - indexing on
artist_id - indexing on
album_id
joins table
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
follower_id |
integer | not null, foreign key |
followee_id |
integer | not null, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
follower_id&follower_idreference theuserstable - indexing on
followee_id - indexing on
[:follower_id, :followee_id], unique: true
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, unique |
email |
string | not null, unique |
session_token |
string | not null |
password_digest |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- indexing on
username, unique: true - indexing on
email, unique: true - indexing on
session_token