2024-02-08 10:50:19 +01:00
|
|
|
// https://dbdiagram.io/d/
|
2024-02-08 20:16:21 +01:00
|
|
|
// Kraut&Rüben ERD
|
2024-02-08 10:50:19 +01:00
|
|
|
|
|
|
|
Table Customer {
|
|
|
|
id string [primary key]
|
2024-02-08 21:25:05 +01:00
|
|
|
address string
|
2024-02-08 10:50:19 +01:00
|
|
|
first_name string
|
|
|
|
last_name string
|
|
|
|
birth_date timestamp
|
|
|
|
email string
|
2024-02-08 20:16:21 +01:00
|
|
|
phone string
|
2024-02-08 10:50:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Table Order {
|
|
|
|
id string [primary key]
|
2024-02-08 21:25:05 +01:00
|
|
|
customer string
|
2024-02-08 20:16:21 +01:00
|
|
|
invoice_amount float
|
2024-02-08 10:50:19 +01:00
|
|
|
order_date timestamp
|
|
|
|
}
|
|
|
|
|
|
|
|
Table Ingredient {
|
|
|
|
id string [primary key]
|
|
|
|
designation string
|
|
|
|
stock integer
|
2024-02-08 20:16:21 +01:00
|
|
|
net_price float
|
2024-02-08 10:50:19 +01:00
|
|
|
unit string
|
2024-02-08 21:25:05 +01:00
|
|
|
carbohydrates float
|
2024-02-08 10:50:19 +01:00
|
|
|
calories integer
|
2024-02-08 20:16:21 +01:00
|
|
|
protein float
|
2024-02-08 10:50:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Table Supplier {
|
|
|
|
id string [primary key]
|
2024-02-08 21:25:05 +01:00
|
|
|
address string
|
2024-02-08 10:50:19 +01:00
|
|
|
email string
|
|
|
|
phone string
|
2024-02-08 21:25:05 +01:00
|
|
|
name string
|
2024-02-08 10:50:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Table Recipe {
|
|
|
|
id string [primary key]
|
2024-02-08 21:25:05 +01:00
|
|
|
preparation_time integer
|
2024-02-08 10:50:19 +01:00
|
|
|
name string
|
|
|
|
description string
|
|
|
|
instructions string
|
|
|
|
}
|
|
|
|
|
2024-02-08 20:16:21 +01:00
|
|
|
Table Address {
|
|
|
|
id string [primary key]
|
|
|
|
city string
|
|
|
|
street string
|
|
|
|
house_number string
|
2024-02-08 21:25:05 +01:00
|
|
|
postal_code string
|
2024-02-08 20:16:21 +01:00
|
|
|
}
|
|
|
|
|
2024-02-08 10:50:19 +01:00
|
|
|
Table RecipeContainsIngredients {
|
|
|
|
recipe string [primary key]
|
|
|
|
ingredient string [primary key]
|
|
|
|
amount integer
|
|
|
|
}
|
|
|
|
|
|
|
|
Table SupplierContainsIngredients {
|
|
|
|
supplier string [primary key]
|
|
|
|
ingredient string [primary key]
|
2024-02-08 20:16:21 +01:00
|
|
|
delivery_cost float
|
2024-02-08 10:50:19 +01:00
|
|
|
delivery_time integer
|
|
|
|
}
|
|
|
|
|
|
|
|
Table OrderContainsIngredients {
|
|
|
|
order string [primary key]
|
|
|
|
ingredient string [primary key]
|
|
|
|
quantity integer
|
|
|
|
}
|
|
|
|
|
2024-02-08 21:25:05 +01:00
|
|
|
Ref: Order.customer > Customer.id
|
|
|
|
Ref: Address.id - Customer.address
|
|
|
|
Ref: Address.id - Supplier.address
|
2024-02-08 10:50:19 +01:00
|
|
|
Ref: SupplierContainsIngredients.supplier > Supplier.id
|
|
|
|
Ref: SupplierContainsIngredients.ingredient > Ingredient.id
|
|
|
|
Ref: OrderContainsIngredients.order > Order.id
|
|
|
|
Ref: OrderContainsIngredients.ingredient > Ingredient.id
|
|
|
|
Ref: RecipeContainsIngredients.recipe > Recipe.id
|
2024-02-08 20:16:21 +01:00
|
|
|
Ref: RecipeContainsIngredients.ingredient > Ingredient.id
|