SQL
CREATE TABLE chatbot_usage (
id INTEGER PRIMARY KEY AUTOINCREMENT,
chatbot_id INTEGER NOT NULL,
prompt_tokens INTEGER DEFAULT 0,
completion_tokens INTEGER DEFAULT 0,
total_tokens INTEGER DEFAULT 0,
estimated_cost REAL DEFAULT 0.0,
model_name TEXT,
created_at TEXT NOT NULL,
FOREIGN KEY (chatbot_id) REFERENCES chatbots(id) ON DELETE CASCADE
)
Columns
| Column | Data type | Allow null | Primary key | Actions |
|---|---|---|---|---|
id |
INTEGER |
✓ | ✓ | Rename | Drop |
chatbot_id |
INTEGER |
Rename | Drop | ||
prompt_tokens |
INTEGER |
✓ | Rename | Drop | |
completion_tokens |
INTEGER |
✓ | Rename | Drop | |
total_tokens |
INTEGER |
✓ | Rename | Drop | |
estimated_cost |
REAL |
✓ | Rename | Drop | |
model_name |
TEXT |
✓ | Rename | Drop | |
created_at |
TEXT |
Rename | Drop |
Foreign Keys
| Column | Destination |
|---|---|
chatbot_id |
chatbots.id |
Indexes
| Name | Columns | Unique | SQL | Drop? |
|---|---|---|---|---|
| idx_chatbot_usage_chatbot_id |
chatbot_id
|
SQL | Drop | |
| idx_chatbot_usage_created_at |
created_at
|
SQL | Drop |