
PRAGMA FOREIGN_KEYS = on;

DROP TABLE IF EXISTS assembly_line;
DROP TABLE IF EXISTS recipe;

-- CREATE TABLE course (
--     pref text,
--     num integer,
--     numCreds integer,
--     title text,
--     PRIMARY KEY (pref, num)
-- );

CREATE TABLE IF NOT EXISTS recipe (
    name text PRIMARY KEY,
    baseflavor text,
    cartonsordered integer
);

CREATE TABLE IF NOT EXISTS assembly_line (
    number integer PRIMARY KEY AUTOINCREMENT,
    recipe text,
    mixins text,
    capacity real,
    FOREIGN KEY (recipe) REFERENCES recipe(name) ON UPDATE SET NULL
        ON DELETE CASCADE
);

INSERT INTO recipe (name, baseflavor, cartonsordered) VALUES
    ('MMV','Vanilla',150);

INSERT INTO assembly_line VALUES
    (1,'MMV','yes',35.2);

