Database Structure - nskins/grocDB GitHub Wiki

The following statements must be executed on an empty database file (.db) to prepare it for INSERTion and SELECTion:


CREATE TABLE recipes (
name TEXT PRIMARY KEY,
directions TEXT,
serves INT);

CREATE TABLE madewith (
recipe TEXT REFERENCES recipes(name),
ingredient TEXT,
ingredientFg TEXT,
ingredientUnit TEXT,
ingredientQty NUMERIC(7,2),
PRIMARY KEY(recipe, ingredient));

Ideally, the program will be able to detect when groc.db is missing. It will create groc.db and execute the above statements.

A copy of the database at this point (after the above statements have been executed) can be found in resources/backup_db. It is named empty_tables.db. It must be renamed to groc.db to be used by the program.