-- Chatbot History Table
-- Run this migration on your production database

CREATE TABLE IF NOT EXISTS chatbot_history (
    id VARCHAR(36) PRIMARY KEY,
    user_id VARCHAR(36) NOT NULL,
    tenant_id VARCHAR(36) NOT NULL,
    question TEXT NOT NULL,
    answer TEXT NOT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_chatbot_user (user_id),
    INDEX idx_chatbot_tenant (tenant_id),
    INDEX idx_chatbot_date (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
