Database Schema - Chase-Riddick/dicey Wiki

Schema Diagram

Users

Column Name Data Type Details
id INT not null, primary key
username STRING not null, unique, min length 3, max length 30
email STRING not null, unique, min length 3, max length 256
hashedPassword STRING.BINARY not null
imgUrl TEXT
bio TEXT
createdAt DATE not null
updatedAt DATE not null

Brews

Column Name Data Type Details
id INT not null, primary key
title STRING not null, min length 3, max length 256
description TEXT
pdfUrl TEXT not null
price FLOAT not null, min 0.01, max 9.99
forSale BOOLEAN default true
userId INT not null, foreign key
createdAt DATE not null
updatedAt DATE not null
  • userId references Users

Images

Column Name Data Type Details
id INT not null, primary key
imgUrl TEXT not null
brewId INT not null, foreign key
  • brewId references Brews

Reviews

Column Name Data Type Details
id INT not null, primary key
rating INT not null, min 0, max 5
content TEXT not null
userId INT not null, foreign key
brewId INT not null, foreign key
createdAt DATE not null
updatedAt DATE not null
  • userId references Users
  • brewId references Brews

Purchases

Column Name Data Type Details
id INT not null, primary key
userId INT not null, foreign key
brewId INT not null, foreign key
createdAt DATE not null
  • userId references Users
  • brewId references Brews

Tags

Column Name Data Type Details
id INT not null, primary key
name STRING not null, max length 50

Brewtags

Column Name Data Type Details
id INT not null, primary key
brewId INT not null, foreign key
tagId INT not null, foreign key
createdAt DATE not null
  • brewId references Brews
  • tagId references Tags