SQL

CREATE TABLE recipe_nutrition  (
  created_at DATETIME,
  update_at DATETIME,
  id INTEGER NOT NULL,
  recipe_id CHAR(32),
  calories VARCHAR,
  fat_content VARCHAR,
  fiber_content VARCHAR,
  protein_content VARCHAR,
  carbohydrate_content VARCHAR,
  sodium_content VARCHAR,
  sugar_content VARCHAR,
  cholesterol_content VARCHAR,
  saturated_fat_content VARCHAR,
  trans_fat_content VARCHAR,
  unsaturated_fat_content VARCHAR,
  PRIMARY KEY (id),
  FOREIGN KEY(recipe_id) REFERENCES recipes (id)
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
created_at DATETIME Rename | Drop
update_at DATETIME Rename | Drop
id INTEGER Rename | Drop
recipe_id CHAR(32) Rename | Drop
calories VARCHAR Rename | Drop
fat_content VARCHAR Rename | Drop
fiber_content VARCHAR Rename | Drop
protein_content VARCHAR Rename | Drop
carbohydrate_content VARCHAR Rename | Drop
sodium_content VARCHAR Rename | Drop
sugar_content VARCHAR Rename | Drop
cholesterol_content VARCHAR Rename | Drop
saturated_fat_content VARCHAR Rename | Drop
trans_fat_content VARCHAR Rename | Drop
unsaturated_fat_content VARCHAR Rename | Drop

Foreign Keys

Column Destination
recipe_id recipes.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
ix_recipe_nutrition_created_at created_at SQL
CREATE INDEX ix_recipe_nutrition_created_at
ON recipe_nutrition (created_at)
Drop
ix_recipe_nutrition_recipe_id recipe_id SQL
CREATE INDEX ix_recipe_nutrition_recipe_id
ON recipe_nutrition (recipe_id)
Drop