SQL

CREATE TABLE automations  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  description TEXT,
  chatbot_id INTEGER NOT NULL,
  trigger_type TEXT NOT NULL,
  is_active INTEGER DEFAULT 1,
  flow_data TEXT NOT NULL,
  schedule TEXT,
  created_at TEXT NOT NULL,
  updated_at TEXT,
  webhook_token TEXT,
  FOREIGN KEY (chatbot_id) REFERENCES chatbots(id) ON DELETE CASCADE
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
name TEXT Rename | Drop
description TEXT Rename | Drop
chatbot_id INTEGER Rename | Drop
trigger_type TEXT Rename | Drop
is_active INTEGER Rename | Drop
flow_data TEXT Rename | Drop
schedule TEXT Rename | Drop
created_at TEXT Rename | Drop
updated_at TEXT Rename | Drop
webhook_token TEXT Rename | Drop

Foreign Keys

Column Destination
chatbot_id chatbots.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_automations_chatbot_id chatbot_id SQL
CREATE INDEX idx_automations_chatbot_id
ON automations(chatbot_id)
Drop
idx_automations_trigger_type trigger_type SQL
CREATE INDEX idx_automations_trigger_type
ON automations(trigger_type)
Drop
idx_automations_webhook_token webhook_token SQL
CREATE UNIQUE INDEX idx_automations_webhook_token
ON automations(webhook_token)
Drop