SQL
CREATE TABLE "recipes_ingredients" (
created_at DATETIME,
update_at DATETIME,
id INTEGER NOT NULL,
position INTEGER,
recipe_id CHAR(32),
title VARCHAR,
note VARCHAR,
unit_id CHAR(32),
food_id CHAR(32),
quantity INTEGER,
reference_id CHAR(32),
original_text VARCHAR,
note_normalized VARCHAR,
original_text_normalized VARCHAR,
referenced_recipe_id CHAR(32),
PRIMARY KEY (id),
CONSTRAINT fk_recipe_subrecipe FOREIGN KEY(referenced_recipe_id) REFERENCES recipes (id),
FOREIGN KEY(unit_id) REFERENCES ingredient_units (id),
FOREIGN KEY(food_id) REFERENCES ingredient_foods (id),
FOREIGN KEY(recipe_id) REFERENCES recipes (id)
)
Columns
| Column | Data type | Allow null | Primary key | Actions |
|---|---|---|---|---|
created_at |
DATETIME |
✓ | Rename | Drop | |
update_at |
DATETIME |
✓ | Rename | Drop | |
id |
INTEGER |
✓ | Rename | Drop | |
position |
INTEGER |
✓ | Rename | Drop | |
recipe_id |
CHAR(32) |
✓ | Rename | Drop | |
title |
VARCHAR |
✓ | Rename | Drop | |
note |
VARCHAR |
✓ | Rename | Drop | |
unit_id |
CHAR(32) |
✓ | Rename | Drop | |
food_id |
CHAR(32) |
✓ | Rename | Drop | |
quantity |
INTEGER |
✓ | Rename | Drop | |
reference_id |
CHAR(32) |
✓ | Rename | Drop | |
original_text |
VARCHAR |
✓ | Rename | Drop | |
note_normalized |
VARCHAR |
✓ | Rename | Drop | |
original_text_normalized |
VARCHAR |
✓ | Rename | Drop | |
referenced_recipe_id |
CHAR(32) |
✓ | Rename | Drop |
Foreign Keys
| Column | Destination |
|---|---|
recipe_id |
recipes.id |
food_id |
ingredient_foods.id |
unit_id |
ingredient_units.id |
referenced_recipe_id |
recipes.id |
Indexes
| Name | Columns | Unique | SQL | Drop? |
|---|---|---|---|---|
| ix_recipes_ingredients_created_at |
created_at
|
SQL | Drop | |
| ix_recipes_ingredients_food_id |
food_id
|
SQL | Drop | |
| ix_recipes_ingredients_note_normalized |
note_normalized
|
SQL | Drop | |
| ix_recipes_ingredients_original_text_normalized |
original_text_normalized
|
SQL | Drop | |
| ix_recipes_ingredients_position |
position
|
SQL | Drop | |
| ix_recipes_ingredients_referenced_recipe_id |
referenced_recipe_id
|
SQL | Drop | |
| ix_recipes_ingredients_unit_id |
unit_id
|
SQL | Drop |