slapify schema - Requiem-of-Zero/Slapify_project GitHub Wiki

users

column name data type details
id integer primary key, not null
email string not null, indexed, unique
username string not null, unique
session_token string not null, indexed, unique
password_digest string not null
created_at datetime not null
updated_at datetime not null
  • index on username, unique: true
  • index on session_token, unique: true
  • index on email, unique: true

songs

column name data type details
id integer primary key, not null
album_id integer not null, indexed
song_name string not null, unique
created_at datetime not null
updated_at datetime not null
  • index on song_name, unique: true

playlist_songs

column name data type details
id integer primary key, not null
playlist_id integer not null, indexed
song_id integer not null, indexed
created_at datetime not null
updated_at datetime not null
  • index on [playlist_id, song_id], unique: true
  • index on song_id, unique: true

playlists

column name data type details
id integer primary key, not null
title string not null, unique
user_id integer not null, indexed
created_at datetime not null
updated_at datetime not null

albums

column name data type details
id integer primary key, not null
album_name string not null
year integer not null
created_at datetime not null
updated_at datetime not null

artists

column name data type detail
id integer primary key, not null
name string not null, unique
created_at datetime not null
updated_at datetime not null

artist_music

column name data type detail
id integer primary key, not null
music_id integer not null, indexed
music_type string not null, indexed
artist_id integer not null, indexed
created_at datetime not null
updated_at datetime not null

likes

column name data type detail
id integer primary key, not null
likeable_id integer not null, indexed
likeable_type string not null, indexed
user_id integer not null, indexed
created_at datetime not null
updated_at datetime not null
  • index on [likable_id, likable_type], unique: true
  • index on user_id, unique: true