SQL

CREATE TABLE api_keys  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  chatbot_id INTEGER NOT NULL,
  name TEXT NOT NULL,
  description TEXT,
  key_prefix TEXT NOT NULL,
  key_hash TEXT NOT NULL UNIQUE,
  is_active INTEGER DEFAULT 1,
  last_used_at TEXT,
  created_at TEXT NOT NULL,
  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
name TEXT Rename | Drop
description TEXT Rename | Drop
key_prefix TEXT Rename | Drop
key_hash TEXT Rename | Drop
is_active INTEGER Rename | Drop
last_used_at TEXT Rename | Drop
created_at TEXT Rename | Drop

Foreign Keys

Column Destination
chatbot_id chatbots.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_api_keys_chatbot_id chatbot_id SQL
CREATE INDEX idx_api_keys_chatbot_id
ON api_keys(chatbot_id)
Drop
idx_api_keys_hash key_hash SQL
CREATE INDEX idx_api_keys_hash
ON api_keys(key_hash)
Drop
sqlite_autoindex_api_keys_1 key_hash SQL
-- no sql found --
Drop