Skip to content

Database Schema

Tran Le edited this page Apr 23, 2021 · 10 revisions

Users

column name data type details
id integer not null, primary key
firstName string not null,
firstName string not null,
username string not null, unique
email string not null, unique
hashedPassword string not null
createdAt timestamp not null
updatedAt timestamp not null

Photos

column name data type details
id integer not null, primary key
title string
caption string
imgURL string not null
userId int not null
albumId int not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references Users table

Albums

column name data type details
id integer not null, primary key
name string not null
userId int not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references Users table

Comments

column name data type details
id integer not null, primary key
body string not null
userId int not null
photoId int not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references Users table
  • photoId references Photos table

**** joins table for album photos or nah

AlbumPhotos

column name data type details
id integer not null, primary key
photoId int not null
albumId int not null
createdAt timestamp not null
updatedAt timestamp not null
  • photoId references Photos table
  • albumId references Albums table

bonus

Tags

column name data type details
id integer not null, primary key
name string not null
photoId int not null
createdAt timestamp not null
updatedAt timestamp not null
  • photoId references Photos table--->

Clone this wiki locally