DB script fix. INT is not the same as INTEGER, apparently

This commit is contained in:
Imbus 2024-05-05 09:37:33 +02:00
parent 9843a078ea
commit 8c8584b6bf

View file

@ -4,20 +4,20 @@
-- Holds the different types of cookies we can make. -- Holds the different types of cookies we can make.
CREATE TABLE IF NOT EXISTS cookies ( CREATE TABLE IF NOT EXISTS cookies (
cookie_id INT PRIMARY KEY, cookie_id INTEGER PRIMARY KEY,
cookie_name VARCHAR(50) NOT NULL UNIQUE cookie_name VARCHAR(50) NOT NULL UNIQUE
); );
-- Our known customers, may need more fields -- Our known customers, may need more fields
CREATE TABLE IF NOT EXISTS customers ( CREATE TABLE IF NOT EXISTS customers (
customer_id INT PRIMARY KEY, customer_id INTEGER PRIMARY KEY,
customer_name VARCHAR(50) NOT NULL, customer_name VARCHAR(50) NOT NULL,
customer_address VARCHAR(50) NOT NULL customer_address VARCHAR(50) NOT NULL
); );
-- Orders from customers. -- Orders from customers.
CREATE TABLE IF NOT EXISTS orders ( CREATE TABLE IF NOT EXISTS orders (
order_id INT PRIMARY KEY, order_id INTEGER PRIMARY KEY,
customer_id INT NOT NULL, customer_id INT NOT NULL,
cookie_id INT NOT NULL, cookie_id INT NOT NULL,
order_date DATE NOT NULL DEFAULT CURRENT_DATE CHECK (order_date >= CURRENT_DATE), order_date DATE NOT NULL DEFAULT CURRENT_DATE CHECK (order_date >= CURRENT_DATE),
@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS orders (
-- Describes ingredients and stock. -- Describes ingredients and stock.
CREATE TABLE IF NOT EXISTS raw_materials ( CREATE TABLE IF NOT EXISTS raw_materials (
ingredient_id INT PRIMARY KEY, ingredient_id INTEGER PRIMARY KEY,
ingredient_name VARCHAR(50) NOT NULL UNIQUE, ingredient_name VARCHAR(50) NOT NULL UNIQUE,
ingredient_quantity INT NOT NULL, ingredient_quantity INT NOT NULL,
unit VARCHAR(50) NOT NULL CHECK (unit IN ('g', 'ml')) unit VARCHAR(50) NOT NULL CHECK (unit IN ('g', 'ml'))
@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS raw_materials (
-- When did we get the ingredients? -- When did we get the ingredients?
CREATE TABLE IF NOT EXISTS raw_materials_deliveries ( CREATE TABLE IF NOT EXISTS raw_materials_deliveries (
delivery_id INT PRIMARY KEY, delivery_id INTEGER PRIMARY KEY,
ingredient_id INT NOT NULL, ingredient_id INT NOT NULL,
delivery_date DATE NOT NULL, delivery_date DATE NOT NULL,
delivery_quantity INT NOT NULL, delivery_quantity INT NOT NULL,
@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS raw_materials_deliveries (
-- Pallets are used to store cookies for delivery -- Pallets are used to store cookies for delivery
-- Order related columns are unused for now. -- Order related columns are unused for now.
CREATE TABLE IF NOT EXISTS pallets ( CREATE TABLE IF NOT EXISTS pallets (
pallet_id INT PRIMARY KEY, pallet_id INTEGER PRIMARY KEY,
cookie_id INT NOT NULL, cookie_id INT NOT NULL,
-- order_id INT NOT NULL, -- order_id INT NOT NULL,
status VARCHAR(50) NOT NULL CHECK (status IN ('freezer', 'delivered', 'blocked')), status VARCHAR(50) NOT NULL CHECK (status IN ('freezer', 'delivered', 'blocked')),