-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
PlasmaNuke edited this page Jan 8, 2024
·
5 revisions
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| username | string | not null, indexed, unique |
| 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 has_many :trackshas_many :likeshas_many :comments
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| artist_id | bigint | not null, indexed, foreign key |
| title | string | not null, indexed |
| description | text | |
| genre | string | |
| album_id | bigint | indexed, foreign key |
| source_url | string | not null, indexed, unique |
| image_url | string | |
| file_type | string | not null |
| duration | float | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
artist_idreferencesusers -
album_idreferencesalbums - index on
artist_id - index on
album_id - index on
title - index on
source_url, unique: true belongs_to :artistbelongs_to :albumhas_many :playlist_trackshas_many :playlists, through: :playlist_tracks, source: :playlist_id
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| artist_id | bigint | not null, indexed, foreign key |
| title | string | not null, indexed |
| description | text | |
| genre | string | |
| image_url | string | |
| release_date | datetime | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
artist_idreferencesusers - index on
artist_id - index on
title has_many :tracks
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| title | string | not null, indexed |
| description | text | |
| genre | string | |
| image_url | string | |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
artist_idreferencesusers - index on
artist_id - index on
track_id - index on
title has_many :playlist_trackshas_many :tracks, through: playlist_tracks, source: track_idhas_many :artists, through: :tracks, source: artist_id
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| playlist_id | bigint | not null, indexed, foreign key |
| track_id | bigint | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
playlist_idreferencesplaylists -
track_idreferencestracks - index on
playlist_id - index on
track_id belongs_to :playlistbelongs_to :track
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| commenter_id | bigint | not null, indexed, foreign key |
| track_id | bigint | not null, indexed, foreign key |
| timestamp | float | not null |
| content | text | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
commenter_idreferencesusers -
track_idreferencestracks belongs_to :commenterbelongs_to :track
| column name | data type | details |
|---|---|---|
| id | bigint | not null, primary key |
| liker_id | bigint | not null, indexed, foreign key |
| track_id | bigint | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
-
liker_idreferencesusers -
track_idreferencestracks belongs_to :likerbelongs_to :track