Skip to content

Database Schema

John Beck edited this page Feb 2, 2021 · 4 revisions

USERS

Column Name Data Type Details
id Integer Pk, not null
username varchar not null, unique
email varchar not null, unique
hashedPassword varchar not Null
  • Sequelize belongsTo Comments association
  • Sequelize belongsToMany users through followers as followerId association
  • Sequelize belongsToMany Stories through userLikedStories as userId association

STORIES

Column Name Data Type Details
id Integer pk, not null
author varchar not null
title varchar not null
date date not null
preview text not null
story text not null
storyLikes Integer not null
imgLink varchar allow null
  • Sequelize belongsTo Comments association
  • Sequelize belongsToMany Users through userLikedStories as storyId association
  • Sequelize belongsToMany Categories through storyCategories as storyId association

COMMENTS

Column Name Data Type Details
id Integer pk, not null
comment text not null
commentLikes integer not null
userId integer not null
storyId integer not null
  • Sequelize hasMany Users association
  • Sequelize hasMany Stories association

CATEGORIES

Column Name Data Type Details
id Integer pk, not null
name varchar not null
  • Sequelize belongsToMany Stories through storyCategories as categoryId association

USERLIKEDSTORIES

Column Name Data Type Details
id Integer pk, not null
userId Integer not Null
storyId Integer not null

STORYCATEGORIES

Column Name Data Type Details
id Integer pk, not null
categoryId Integer not Null
storyId Integer not null

FOLLOWERS

Column Name Data Type Details
id Integer pk, not null
userId Integer not Null
followerId Integer not null

USERLIKEDCOMMENTS

Column Name Data Type Details
id Integer pk, not null
userId Integer not Null
commentId Integer not null

Clone this wiki locally