Skip to content

Database Schema

Guilherme Pace edited this page Jan 25, 2021 · 9 revisions


Tables

Users

Column Name Data Type Details
id integer not null, primary key
username varchar(30) not null, indexed, unique
email varchar(50) not null, indexed, unique
firstName varchar(50) not null
lastName varchar(50) not null
websiteUrl varchar(100)
avatarUrl varchar(100)
hashedPassword string not null
createdAt datetime not null
updatedAt datetime not null
  • Sequelize hasMany Tracks association
  • Sequelize hasMany Comments association

Tracks

Column Name Data Type Details
id integer not null, primary key
title varchar(30) not null, indexed
description string not null
imageUrl varchar(100)
userId integer not null
genreId integer not null
createdAt datetime not null
updatedAt datetime not null
  • Sequelize belongsTo Users association
  • Sequelize belongsTo Genres association
  • Sequelize hasMany Comments association

Genres

Column Name Data Type Details
id integer not null, primary key
name varchar(50) not null, unique
createdAt datetime not null
updatedAt datetime not null
  • Sequelize hasMany Tracks association

Comments

Column Name Data Type Details
id integer not null, primary key
content string not null
userId integer not null
trackId integer not null
createdAt datetime not null
updatedAt datetime not null
  • Sequelize belongsTo Users association
  • Sequelize belongsTo Tracks association

Stretch Goal Tables

  • Playlists
  • User_Playlist (join table)
  • Likes
  • Follows
Clone this wiki locally