Skip to content

Database Schema

Daniel LaVergne edited this page Mar 16, 2022 · 5 revisions

Users

column name data type detail
id integer not null, primary key
username string not null, unique
passwordHash binary not null
firstName string not null
lastName string not null
about text
profileImage string
created_at timestamp not null

Stories

column name data type detail
id integer not null, primary key
authorId integer not null, foreign key
title string not null
likes integer not null

authorId references users.id

Comments

column name data type detail
id integer not null, primary key
userId integer not null, foreign key
storyId integer not null, foreign key
content text

userId references users.id
storyId references story.id

Likes

column name data type detail
likeId integer not null, primary key
storyId integer not null, foreign key
commentId integer not null, foreign key
userId integer not null, foreign key

storyId references stories.id
commentId references comments.id
userId references users.id

Relationships

column name data type detail
followId integer not null, primary key
followingUserId integer not null, foreign key
followerUserId integer not null, foreign key

followingUserId references users.id
followerUserId references users.id

StoryToTopics

column name data type detail
storyId integer not null, primary key
categoryId integer not null, foreign key

categoryId references categories.id

CategoriesTopics

column name data type detail
id integer not null, primary key
name string not null

Clone this wiki locally