SQL

CREATE TABLE recipe_comments  (
  created_at DATETIME,
  update_at DATETIME,
  id CHAR(32) NOT NULL,
  text VARCHAR,
  recipe_id CHAR(32) NOT NULL,
  user_id CHAR(32) NOT NULL,
  PRIMARY KEY (id),
  FOREIGN KEY(recipe_id) REFERENCES recipes (id),
  FOREIGN KEY(user_id) REFERENCES users (id)
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
created_at DATETIME Rename | Drop
update_at DATETIME Rename | Drop
id CHAR(32) Rename | Drop
text VARCHAR Rename | Drop
recipe_id CHAR(32) Rename | Drop
user_id CHAR(32) Rename | Drop

Foreign Keys

Column Destination
user_id users.id
recipe_id recipes.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
ix_recipe_comments_created_at created_at SQL
CREATE INDEX ix_recipe_comments_created_at
ON recipe_comments (created_at)
Drop
ix_recipe_comments_recipe_id recipe_id SQL
CREATE INDEX ix_recipe_comments_recipe_id
ON recipe_comments (recipe_id)
Drop
ix_recipe_comments_user_id user_id SQL
CREATE INDEX ix_recipe_comments_user_id
ON recipe_comments (user_id)
Drop
sqlite_autoindex_recipe_comments_1 id SQL
-- no sql found --
Drop