Bageri AB fortsätning

This commit is contained in:
Imbus 2024-03-19 14:34:40 +01:00
parent 9b06ea6c45
commit c54ecdab71

View file

@ -16,13 +16,15 @@ CREATE TABLE IF NOT EXISTS Recipes (
ProductID int, ProductID int,
PRIMARY KEY (RecipeName, RecipeYear) PRIMARY KEY (RecipeName, RecipeYear)
FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID) FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID)
FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
); );
CREATE TABLE IF NOT EXISTS ingredience ( CREATE TABLE IF NOT EXISTS ingredience (
IngredienceID int PRIMARY KEY, IngredienceID int PRIMARY KEY,
RawMaterialName varchar(100), RawMaterialName varchar(100),
amount int, amount int,
unit varchar(50) unit varchar(50),
FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials(RawMaterialName)
); );
CREATE TABLE IF NOT EXISTS RawMaterials ( CREATE TABLE IF NOT EXISTS RawMaterials (
@ -78,8 +80,6 @@ CREATE TABLE IF NOT EXISTS PalletTraceability (
); );
-- ALTER TABLE Recipes ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID);
-- ALTER TABLE ingredience ADD FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials (RawMaterialName);
-- ALTER TABLE PalletsProduced ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID); -- ALTER TABLE PalletsProduced ADD FOREIGN KEY (ProductID) REFERENCES Products (ProductID);
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID); -- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID);
-- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet); -- ALTER TABLE PalletsDelivered ADD FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet);