Snake case table names

This commit is contained in:
Imbus 2024-05-03 01:59:07 +02:00
parent e6560653d9
commit 87ba5bb679

View file

@ -1,88 +1,88 @@
CREATE TABLE IF NOT EXISTS Customers ( CREATE TABLE IF NOT EXISTS customers (
CustomerID int PRIMARY KEY, customer_id int PRIMARY KEY,
Name varchar(100), name varchar(100),
Address varchar(255) address varchar(255)
); );
CREATE TABLE IF NOT EXISTS Products ( CREATE TABLE IF NOT EXISTS products (
ProductID int PRIMARY KEY, product_id int PRIMARY KEY,
Name varchar(100) name varchar(100)
); );
CREATE TABLE IF NOT EXISTS Recipes ( CREATE TABLE IF NOT EXISTS recipes (
RecipeName varchat(100), recipe_name varchar(100),
RecipeYear Year, recipe_year year,
ingrediences int, ingredients int,
ProductID int, product_id int,
PRIMARY KEY (RecipeName, RecipeYear), PRIMARY KEY (recipe_name, recipe_year),
FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID), FOREIGN KEY (ingredients) REFERENCES ingredients(ingredient_id),
FOREIGN KEY (ProductID) REFERENCES Products(ProductID) FOREIGN KEY (product_id) REFERENCES products(product_id)
); );
CREATE TABLE IF NOT EXISTS ingredience ( CREATE TABLE IF NOT EXISTS ingredients (
IngredienceID int PRIMARY KEY, ingredient_id int PRIMARY KEY,
RawMaterialName varchar(100), raw_material_name varchar(100),
amount int, amount int,
unit varchar(50), unit varchar(50),
FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials(RawMaterialName) FOREIGN KEY (raw_material_name) REFERENCES raw_materials(raw_material_name)
); );
CREATE TABLE IF NOT EXISTS RawMaterials ( CREATE TABLE IF NOT EXISTS raw_materials (
RawMaterialName varchar(100) PRIMARY KEY, raw_material_name varchar(100) PRIMARY KEY,
Quantity int, quantity int,
LastDeliveryDateTime datetime last_delivery_date_time datetime
); );
CREATE TABLE IF NOT EXISTS PalletsProduced ( CREATE TABLE IF NOT EXISTS pallets_produced (
PalletID int PRIMARY KEY, pallet_id int PRIMARY KEY,
ProductID int, product_id int,
ProductionDateTime datetime, production_date_time datetime,
FOREIGN KEY (ProductID) REFERENCES Products (ProductID) FOREIGN KEY (product_id) REFERENCES products (product_id)
); );
CREATE TABLE IF NOT EXISTS PalletsDelivered ( CREATE TABLE IF NOT EXISTS pallets_delivered (
DeliveredID int PRIMARY KEY, delivered_id int PRIMARY KEY,
PalletID int, pallet_id int,
DeliveryDateTime datetime, delivery_date_time datetime,
FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID), FOREIGN KEY (pallet_id) REFERENCES pallets_produced (pallet_id),
FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet) FOREIGN KEY (delivered_id) REFERENCES truck (pallet)
); );
CREATE TABLE IF NOT EXISTS Truck ( CREATE TABLE IF NOT EXISTS truck (
truckId int PRIMARY KEY, truck_id int PRIMARY KEY,
capacity int, capacity int,
Pallet int pallet int
); );
CREATE TABLE IF NOT EXISTS loadingBill ( CREATE TABLE IF NOT EXISTS loading_bill (
LoadingbillID int PRIMARY KEY, loadingbill_id int PRIMARY KEY,
adress varchar(100), address varchar(100),
customer varchar(100), customer varchar(100),
truckID int, truck_id int,
FOREIGN KEY (truckID) REFERENCES Truck (truckId) FOREIGN KEY (truck_id) REFERENCES truck (truck_id)
); );
CREATE TABLE IF NOT EXISTS Orders ( CREATE TABLE IF NOT EXISTS orders (
OrderID int PRIMARY KEY, order_id int PRIMARY KEY,
CustomerID int, customer_id int,
ProductID int, product_id int,
Quantity int, quantity int,
OrderDateTime datetime, order_date_time datetime,
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (customer_id) REFERENCES customers (customer_id),
FOREIGN KEY (ProductID) REFERENCES Products (ProductID) FOREIGN KEY (product_id) REFERENCES products (product_id)
); );
CREATE TABLE IF NOT EXISTS BlockedProducts ( CREATE TABLE IF NOT EXISTS blocked_products (
BlockedProductID int PRIMARY KEY, blocked_product_id int PRIMARY KEY,
ProductID int, product_id int,
BlockedDateTime datetime, blocked_date_time datetime,
FOREIGN KEY (ProductID) REFERENCES Products (ProductID) FOREIGN KEY (product_id) REFERENCES products (product_id)
); );
CREATE TABLE IF NOT EXISTS PalletTraceability ( CREATE TABLE IF NOT EXISTS pallet_traceability (
TraceID int PRIMARY KEY, trace_id int PRIMARY KEY,
location varchar(100), location varchar(100),
locationdate datetime, location_date datetime,
PalletID int, pallet_id int,
FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID) FOREIGN KEY (pallet_id) REFERENCES pallets_produced (pallet_id)
); );