SQL

CREATE TABLE follow_ups_sent  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  chatbot_id INTEGER NOT NULL,
  conversation_id INTEGER NOT NULL,
  user_id TEXT NOT NULL,
  message_content TEXT NOT NULL,
  sent_at TEXT NOT NULL,
  status TEXT DEFAULT 'sent',
  FOREIGN KEY (chatbot_id) REFERENCES chatbots(id) ON DELETE CASCADE,
  FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
chatbot_id INTEGER Rename | Drop
conversation_id INTEGER Rename | Drop
user_id TEXT Rename | Drop
message_content TEXT Rename | Drop
sent_at TEXT Rename | Drop
status TEXT Rename | Drop

Foreign Keys

Column Destination
conversation_id conversations.id
chatbot_id chatbots.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_follow_ups_chatbot_id chatbot_id SQL
CREATE INDEX idx_follow_ups_chatbot_id
ON follow_ups_sent(chatbot_id)
Drop
idx_follow_ups_conversation_id conversation_id SQL
CREATE INDEX idx_follow_ups_conversation_id
ON follow_ups_sent(conversation_id)
Drop
idx_follow_ups_sent_at sent_at SQL
CREATE INDEX idx_follow_ups_sent_at
ON follow_ups_sent(sent_at)
Drop