-
Notifications
You must be signed in to change notification settings - Fork 1
Schema
Timothy Chang edited this page Feb 3, 2023
·
28 revisions
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
username |
string | not null, indexed, unique |
password_digest |
string | not null |
email |
string | not null, indexed, unique |
name |
string | not null |
birth_date |
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 has_many songshas_many likeshas_many playlists
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
album_id |
integer | foreign key |
artist_id |
integer | not null, indexed, foreign key |
title |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
title - index on
artist_id -
artist_idreferencesartists -
album_idreferencesalbums has_many likesbelongs_to userbelongs_to playlistbelongs_to artistbelongs_to album
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
author_id |
integer | not null, indexed, foreign key |
title |
string | not null, indexed |
public |
boolean | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
author_id - index on
title -
author_idreferencesartists belongs_to userhas_many songshas_many likes
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
liker_id |
integer | not null, foreign key, indexed |
media_id |
integer | not null, foreign key, indexed |
media_type |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
liker_id - index on
media_id [:liker_id, :media_id] unique: true-
liker_idreferencesusers -
media_idreferences[songs, playlists, albums] belongs_to userbelongs_to playlistbelongs_to songbelongs_to album
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
name |
string | not null, indexed |
description |
text | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
name has_many songshas_many albums
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
title |
string | not null, indexed |
artist_id |
integer | not null, foreign key, indexed |
published_date |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
title - index on
artist_id, unique: true -
artist_idreferencesartists belongs_to artisthas_many likeshas_many songs