This commit is contained in:
Imbus 2024-05-04 13:57:55 +02:00
parent c186c3b515
commit c8752c388c

View file

@ -3,7 +3,7 @@
--------------------------------------------
-- Holds the different types of cookies we can make.
CREATE TABLE cookies (
CREATE TABLE IF NOT EXISTS cookies (
cookie_id INT PRIMARY KEY,
cookie_name VARCHAR(50) NOT NULL UNIQUE
);
@ -21,8 +21,8 @@ CREATE TABLE IF NOT EXISTS orders (
customer_id INT NOT NULL,
cookie_id INT NOT NULL,
order_date DATE NOT NULL DEFAULT CURRENT_DATE CHECK (order_date >= CURRENT_DATE),
FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
FOREIGN KEY (cookie_id) REFERENCES cookie(cookie_id)
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
FOREIGN KEY (cookie_id) REFERENCES cookies(cookie_id)
);
--------------------------------------------
@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS pallets (
order_id INT NOT NULL,
status VARCHAR(50) NOT NULL CHECK (status IN ('freezer', 'delivered', 'blocked')),
production_date DATE NOT NULL,
FOREIGN KEY (cookie_id) REFERENCES cookie(cookie_id)
FOREIGN KEY (cookie_id) REFERENCES cookies(cookie_id)
FOREIGN KEY (order_id) REFERENCES orders(order_id)
);