CREATE TABLE `analytics_events` ( `id` int AUTO_INCREMENT NOT NULL, `conversationId` int, `sessionId` varchar(64), `eventType` enum('session_start','message_sent','message_received','intent_detected','flow_triggered','escalated','resolved_by_bot','resolved_by_agent','abandoned','button_clicked','feedback_positive','feedback_negative') NOT NULL, `category` varchar(64), `metadata` json, `createdAt` timestamp NOT NULL DEFAULT (now()), CONSTRAINT `analytics_events_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `api_connections` ( `id` int AUTO_INCREMENT NOT NULL, `name` varchar(255) NOT NULL, `description` text, `category` varchar(64), `httpMethod` enum('GET','POST','PUT','DELETE') NOT NULL DEFAULT 'GET', `endpoint` varchar(1024) NOT NULL, `headers` json, `inputVariables` json, `outputVariables` json, `testPayload` json, `isActive` boolean NOT NULL DEFAULT true, `executionCount` int NOT NULL DEFAULT 0, `lastExecutedAt` timestamp, `createdById` int, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `api_connections_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `data_sources` ( `id` int AUTO_INCREMENT NOT NULL, `name` varchar(255) NOT NULL, `sourceType` enum('url','file','qa_pair','api') NOT NULL, `sourceStatus` enum('active','inactive','syncing','error') NOT NULL DEFAULT 'active', `config` json, `lastSyncedAt` timestamp, `itemCount` int NOT NULL DEFAULT 0, `createdById` int, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `data_sources_id` PRIMARY KEY(`id`) );