Datenbank Design aktualisiert

Fabian Schieder 2026-02-18 14:24:45 +00:00
parent 1b200b2912
commit 73bb2547bd

@ -3,7 +3,8 @@
> ![products](https://fabianschieder.com/git/fabian/Geizkragen/src/branch/main/assets/images/DB_Design_products.png)
```sql
Table categories {
Table categories
{
categoryID int [pk]
name varchar(255)
parentCategoryID int
@ -11,30 +12,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
@ -48,14 +53,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
}
@ -63,7 +70,8 @@ Table categoryAttributes {
Ref: "categoryAttributes"."categoryID" < "categories"."categoryID"
Ref: "categoryAttributes"."attributeID" < "attributes"."attributeID"
Table productAttributes {
Table productAttributes
{
productID int
attributeID int
valueString varchar(255)
@ -76,21 +84,33 @@ 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
}
@ -98,7 +118,8 @@ Table userRoles {
Ref: "userRoles"."userID" < "users"."userID"
Ref: "userRoles"."roleID" < "roles"."roleID"
Table userFavorites {
Table userFavorites
{
userID int
productID int
createdAt timestamp
@ -107,7 +128,8 @@ Table userFavorites {
Ref: "userFavorites"."userID" < "users"."userID"
Ref: "userFavorites"."productID" < "products"."productID"
Table priceAlerts {
Table priceAlerts
{
alertID int [pk]
userID int
productID int
@ -119,7 +141,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)
@ -130,7 +153,8 @@ Table notifications {
Ref: "notifications"."userID" < "users"."userID"
Table reviews {
Table reviews
{
reviewID int [pk]
userID int
productID int
@ -142,11 +166,13 @@ Table reviews {
Ref: "reviews"."userID" < "users"."userID"
Ref: "reviews"."productID" < "products"."productID"
Table userSessions {
Table userSessions
{
sessionID varchar(128) [pk]
userID int
expiresAt timestamp
}
Ref: "userSessions"."userID" < "users"."userID"
```