developer_analysis/setup.sql

31 lines
777 B
MySQL
Raw Normal View History

2023-01-11 02:30:40 +00:00
CREATE TABLE IF NOT EXISTS chemicals (
chemical_id CHAR(36) PRIMARY KEY,
name TEXT UNIQUE
);
CREATE TABLE IF NOT EXISTS recipes (
recipe_id CHAR(36) PRIMARY KEY,
name TEXT UNIQUE
);
CREATE TABLE IF NOT EXISTS components (
component_id CHAR(36) PRIMARY KEY,
recipe_id CHAR(36),
chemical_id CHAR(36),
grams REAL,
milliliters REAL,
makes REAL,
note TEXT,
CONSTRAINT fk_recipes FOREIGN KEY (recipe_id) REFERENCES recipes(recipe_id),
CONSTRAINT fk_chemicals FOREIGN KEY (chemical_id) REFERENCES chemicals(chemical_id)
);
CREATE TABLE IF NOT EXISTS supply (
supply_id CHAR(36) PRIMARY KEY,
chemical_id CHAR(36),
url TEXT UNIQUE,
grams REAL,
milliliters REAL,
price INTEGER,
CONSTRAINT fk_chemicals FOREIGN KEY (chemical_id) REFERENCES chemicals(chemical_id)
);