Compare commits
No commits in common. "0b8a771aa59984503de48e3ea8818caec00a2f1b" and "fcde7e6f1ea90296a2d4aef48727d7335b9bf502" have entirely different histories.
0b8a771aa5
...
fcde7e6f1e
2 changed files with 9 additions and 2 deletions
|
@ -58,7 +58,15 @@ CREATE TABLE IF NOT EXISTS pallets (
|
||||||
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')),
|
||||||
production_date DATE NOT NULL,
|
production_date DATE NOT NULL,
|
||||||
delivery_date DATE DEFAULT NULL,
|
|
||||||
FOREIGN KEY (cookie_id) REFERENCES cookies(cookie_id)
|
FOREIGN KEY (cookie_id) REFERENCES cookies(cookie_id)
|
||||||
FOREIGN KEY (order_id) REFERENCES orders(order_id)
|
FOREIGN KEY (order_id) REFERENCES orders(order_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Has an order been delivered?
|
||||||
|
CREATE TABLE IF NOT EXISTS deliveries (
|
||||||
|
delivery_id INT PRIMARY KEY,
|
||||||
|
pallet_id INT NOT NULL,
|
||||||
|
customer_name VARCHAR(50) NOT NULL,
|
||||||
|
delivery_date DATE NOT NULL DEFAULT CURRENT_DATE CHECK (delivery_date >= CURRENT_DATE),
|
||||||
|
FOREIGN KEY (pallet_id) REFERENCES pallets(pallet_id)
|
||||||
|
);
|
1
makefile
1
makefile
|
@ -18,7 +18,6 @@ dbdump:
|
||||||
sqlite3 app/krusty.db .dump
|
sqlite3 app/krusty.db .dump
|
||||||
|
|
||||||
migrate:
|
migrate:
|
||||||
rm -f app/krusty.db
|
|
||||||
sqlite3 app/krusty.db < app/Migrations/create-schema.sql
|
sqlite3 app/krusty.db < app/Migrations/create-schema.sql
|
||||||
sqlite3 app/krusty.db < app/Migrations/initial-data.sql
|
sqlite3 app/krusty.db < app/Migrations/initial-data.sql
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue