Skip to content

Database Schema

Manna edited this page Jul 19, 2021 · 12 revisions

Users

column name data type details
id integer not null, PK
username string(50) not null, unique
email string(255) not null, unique
hashedPassword string(255) not null
createdAt date not null
updatedAt date not null
  • hasMany Comments
  • hasMany Albums

Albums

column name datatype details
id integer not null, PK
title string(50) not null
userId integer not null, FK(Users)
createdAt date not null
updatedAt date not null
  • belongsTo Users
  • belongsToMany Images through Joins

Images

column name datatype details
id integer not null, PK
title string(50) unique
userId integer not null, FK(Users)
imageUrl string(255) not null
description text not null
createdAt date not null
updatedAt date not null
  • belongsToMany Albums through Joins
  • belongsTo Users
  • hasMany Comments

AlbumImages (joins table)

column name datatype details
id integer not null, PK
imageId integer not null, FK(Images)
albumId integer not null, FK(Albums)
createdAt date not null
updatedAt date not null
  • belongsTo Albums
  • hasMany Images

Comments

column name datatype details
id integer not null, PK
userId integer not null, FK(Users)
imageId integer not null, FK(Images)
comment text not null
createdAt date not null
updatedAt date not null
  • belongsTo Users
  • belongsTo Images

SoulShot Database Schema

Clone this wiki locally