Database Schema - nM15-vge/throughLens GitHub Wiki

Users

Column Name Data Type Details
id integer not null, primary key
firstName varchar(30) not null
lastName varchar(30) not null
avatarUrl varchar(255) optional
username varchar(30) not null, unique
email varchar(256) not null, unique
hashedPassword string.binary not null
created_at timestamp not null
updated_at timestamp not null

Albums

Column Name Data Type Details
id integer not null, primary key
title varchar(30) not null
description varchar(150) not null
userId integer not null
public boolean not null, default false
created_at timestamp not null
updated_at timestamp not null
  • userId references Users table

Photos

Column Name Data Type Details
id integer not null, primary key
imageUrl varchar not null, unique
title varchar(30) not null
description varchar(150) not null
userId integer not null
albumId integer optional
public boolean not null, default false
created_at timestamp not null
updated_at timestamp not null
  • userId references Users table
  • albumId references the Albums table

FavoriteAlbums

Column Name Data Type Details
id integer not null, primary key
userId integer not null
albumId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references Users table
  • albumId references Albums table

FavoritePhotos

Column Name Data Type Details
id integer not null, primary key
userId integer not null
photoId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references Users table
  • photoId references Photos table

CommentAlbums

Column Name Data Type Details
id integer not null, primary key
comment varchar(256) not null
userId integer not null
albumId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references the Users table
  • albumId references the Albums table

CommentPhotos

Column Name Data Type Details
id integer not null, primary key
comment varchar(256) not null
userId integer not null
photoId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references the Users table
  • photoId references the Photos table

StarAlbums

Column Name Data Type Details
id integer not null, primary key
star integer not null
userId integer not null
albumId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references the Users table
  • albumId references the Albums table

StarPhotos

Column Name Data Type Details
id integer not null, primary key
star integer not null
userId integer not null
photoId integer not null
created_at timestamp not null
updated_at timestamp not null
  • userId references the Users table
  • photoId references the Photos table