SQL

CREATE TABLE google_calendar_connections  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  chatbot_id INTEGER NOT NULL UNIQUE,
  access_token TEXT NOT NULL,
  refresh_token TEXT,
  token_expiry TEXT,
  calendar_id TEXT NOT NULL DEFAULT 'primary',
  calendar_name TEXT,
  created_at TEXT NOT NULL,
  updated_at TEXT,
  working_hours_json 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
chatbot_id INTEGER Rename | Drop
access_token TEXT Rename | Drop
refresh_token TEXT Rename | Drop
token_expiry TEXT Rename | Drop
calendar_id TEXT Rename | Drop
calendar_name TEXT Rename | Drop
created_at TEXT Rename | Drop
updated_at TEXT Rename | Drop
working_hours_json TEXT Rename | Drop

Foreign Keys

Column Destination
chatbot_id chatbots.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_gcal_chatbot_id chatbot_id SQL
CREATE INDEX idx_gcal_chatbot_id
ON google_calendar_connections(chatbot_id)
Drop
sqlite_autoindex_google_calendar_connections_1 chatbot_id SQL
-- no sql found --
Drop