Database Schema - masontaylor7/Large GitHub Wiki

Users

name data type constraints
id serial primary key, not null
username string(50) not null, unique
email string not null, unique
hashPassword string not null
createdAt datetime not null
updatedAt datetime not null

Posts

name data type constraints
id serial primary key, not null
content text not null
userId integer not null, foreign key references Users
createdAt datetime not null
updatedAt datetime not null

Comments

name data type constraints
id serial primary key, not null
content text not null
userId integer not null, foreign key references Users
postId integer not null, foreign key references Posts
createdAt datetime not null
updatedAt datetime not null

Likes

name data type constraints
id serial primary key, not null
userId integer not null, foreign key references Users
postId integer not null, foreign key references Posts
commentId integer not null, foreign key references Comments

Followers

name data type constraints
followedId integer not null, foreign key references Users
followerId integer not null, foreign key references Users