sqlite3 omnomr.sqlite
CREATE TABLE comments (
id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INT NOT NULL,
recipe_id INT NOT NULL, comment TEXT);
CREATE TABLE ingredient (
id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(128) NOT NULL,
form VARCHAR(128), notes TEXT);
CREATE TABLE recipe (
id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INT NOT NULL,
name VARCHAR(250) NOT NULL, time_prep FLOAT, time_cook FLOAT,
portions INT NOT NULL, description TEXT NOT NULL, photo_id INT);
CREATE TABLE recipe_ingredient (
recipe_id INT NOT NULL, ingredient_id INT NOT NULL, count INT NOT NULL,
unit_id INT NOT NULL);
CREATE TABLE unit (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name_single VARCHAR(64) NOT NULL, name_plural VARCHAR(64) NOT NULL);
CREATE TABLE user (
id INTEGER PRIMARY KEY AUTOINCREMENT, email VARCHAR(250),
name VARCHAR(128), password CHAR(40));
INSERT INTO unit(name_single, name_plural) VALUES('cup', 'cups');
INSERT INTO unit(name_single, name_plural) VALUES('tsp', 'tsps');
INSERT INTO unit(name_single, name_plural) VALUES('tbsp', 'tbsps');
INSERT INTO unit(name_single, name_plural) VALUES('piece', 'pieces');
INSERT INTO unit(name_single, name_plural) VALUES('kg', 'kg');
INSERT INTO unit(name_single, name_plural) VALUES('dl', 'dl');
INSERT INTO unit(name_single, name_plural) VALUES('ounce', 'ounces');
INSERT INTO unit(name_single, name_plural) VALUES('pound', 'pounds');