-
Notifications
You must be signed in to change notification settings - Fork 1
Schema
Madeline Wilson edited this page Nov 1, 2021
·
27 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
username |
string | not null, indexed, unique, limit: 15 |
name |
string | |
location |
string | |
about |
text | |
img_url |
text | |
artist_id |
integer | indexed, foreign key |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true - index on
username, unique: true, limit: 15 - index on
name - index on
session_token, unique:true - index on
artist_id, allow_nil -
namedefaults to value ofusernameunless otherwise specified
// Users will have a followers and followees many-to-many self-join association through the user.id and artist_id in the users table.
// Users will have a genres_liked association through the user_id in the genre_joins table.
// User show page will change based on the boolean value of the artist key. If true, the show page will include the user's songs and albums, otherwise, the show page will include the artists that the user is following, along with their preferred genres.
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null. |
artist_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
artist_id, not null -
artist_idreferencesusers - has_many
genresthroughgenre_joins,album_id - has_many
songsthroughsongs,album_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null, indexed |
album_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
title, not null - index on
album_id, not null -
album_idreferencesalbums
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
name, not null - has_many
albums, throughgenre_joins,genre_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
album_id |
string | not null, indexed, foreign key |
genre_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
album_id, not null - index on
genre_id, not null