diff --git a/info/DB-Design.sql b/info/DB-Design.sql index 055ebe3..9d0030c 100644 --- a/info/DB-Design.sql +++ b/info/DB-Design.sql @@ -1,4 +1,5 @@ -Table categories { +Table categories +{ categoryID int [pk] name varchar(255) parentCategoryID int @@ -6,30 +7,34 @@ Table categories { Ref: "categories"."parentCategoryID" < "categories"."categoryID" -Table brands { +Table brands +{ brandID int [pk] name varchar(255) } -Table products { +Table products +{ productID int [pk] categoryID int brandID int model varchar(255) - ean varchar(20) description text + imagePath varchar(255) } Ref: "products"."categoryID" < "categories"."categoryID" Ref: "products"."brandID" < "brands"."brandID" -Table shops { +Table shops +{ shopID int [pk] name varchar(255) website varchar(255) } -Table offers { +Table offers +{ offerID int [pk] productID int shopID int @@ -43,14 +48,16 @@ Table offers { Ref: "offers"."productID" < "products"."productID" Ref: "offers"."shopID" < "shops"."shopID" -Table attributes { +Table attributes +{ attributeID int [pk] name varchar(255) unit varchar(50) - dataType varchar(20) + dataType varchar(20) } -Table categoryAttributes { +Table categoryAttributes +{ categoryID int attributeID int } @@ -58,7 +65,8 @@ Table categoryAttributes { Ref: "categoryAttributes"."categoryID" < "categories"."categoryID" Ref: "categoryAttributes"."attributeID" < "attributes"."attributeID" -Table productAttributes { +Table productAttributes +{ productID int attributeID int valueString varchar(255) @@ -72,21 +80,32 @@ Ref: "productAttributes"."attributeID" < "attributes"."attributeID" -Table users { + + + + + + + +Table users +{ userID int [pk] email varchar(255) passwordHash varchar(255) displayName varchar(255) isActive boolean createdAt timestamp + profilePicture varchar(255) } -Table roles { +Table roles +{ roleID int [pk] name varchar(50) } -Table userRoles { +Table userRoles +{ userID int roleID int } @@ -94,7 +113,8 @@ Table userRoles { Ref: "userRoles"."userID" < "users"."userID" Ref: "userRoles"."roleID" < "roles"."roleID" -Table userFavorites { +Table userFavorites +{ userID int productID int createdAt timestamp @@ -103,7 +123,8 @@ Table userFavorites { Ref: "userFavorites"."userID" < "users"."userID" Ref: "userFavorites"."productID" < "products"."productID" -Table priceAlerts { +Table priceAlerts +{ alertID int [pk] userID int productID int @@ -115,7 +136,8 @@ Table priceAlerts { Ref: "priceAlerts"."userID" < "users"."userID" Ref: "priceAlerts"."productID" < "products"."productID" -Table notifications { +Table notifications +{ notificationID int [pk] userID int title varchar(255) @@ -126,7 +148,8 @@ Table notifications { Ref: "notifications"."userID" < "users"."userID" -Table reviews { +Table reviews +{ reviewID int [pk] userID int productID int @@ -138,7 +161,8 @@ Table reviews { Ref: "reviews"."userID" < "users"."userID" Ref: "reviews"."productID" < "products"."productID" -Table userSessions { +Table userSessions +{ sessionID varchar(128) [pk] userID int expiresAt timestamp