SQL

CREATE TABLE recipe_timeline_events  (
  created_at DATETIME,
  update_at DATETIME,
  id CHAR(32) NOT NULL,
  recipe_id CHAR(32) NOT NULL,
  user_id CHAR(32) NOT NULL,
  subject VARCHAR NOT NULL,
  message VARCHAR,
  event_type VARCHAR,
  image VARCHAR,
  timestamp DATETIME,
  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
recipe_id CHAR(32) Rename | Drop
user_id CHAR(32) Rename | Drop
subject VARCHAR Rename | Drop
message VARCHAR Rename | Drop
event_type VARCHAR Rename | Drop
image VARCHAR Rename | Drop
timestamp DATETIME Rename | Drop

Foreign Keys

Column Destination
user_id users.id
recipe_id recipes.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
ix_recipe_timeline_events_created_at created_at SQL
CREATE INDEX ix_recipe_timeline_events_created_at
ON recipe_timeline_events (created_at)
Drop
ix_recipe_timeline_events_recipe_id recipe_id SQL
CREATE INDEX ix_recipe_timeline_events_recipe_id
ON recipe_timeline_events (recipe_id)
Drop
ix_recipe_timeline_events_timestamp timestamp SQL
CREATE INDEX ix_recipe_timeline_events_timestamp
ON recipe_timeline_events (timestamp)
Drop
ix_recipe_timeline_events_user_id user_id SQL
CREATE INDEX ix_recipe_timeline_events_user_id
ON recipe_timeline_events (user_id)
Drop
sqlite_autoindex_recipe_timeline_events_1 id SQL
-- no sql found --
Drop