|
|
-- MySQL dump 10.13 Distrib 8.0.45, for Linux (x86_64)
|
|
|
--
|
|
|
-- Host: localhost Database: lingshu
|
|
|
-- ------------------------------------------------------
|
|
|
-- Server version 8.0.45-0ubuntu0.22.04.1
|
|
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
|
/*!50503 SET NAMES utf8mb4 */;
|
|
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `agent_config_versions`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `agent_config_versions`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `agent_config_versions` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`agent_id` bigint unsigned NOT NULL,
|
|
|
`config_type` enum('soul','memory','both') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '变更类型',
|
|
|
`version_no` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '版本号,如 v1.0.3',
|
|
|
`change_summary` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '修改内容摘要',
|
|
|
`change_source` enum('manual','agent_optimize','system_auto') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'manual',
|
|
|
`snapshot_soul` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'soul.md 快照内容',
|
|
|
`snapshot_memory` json DEFAULT NULL COMMENT 'memory规则列表快照(JSON数组)',
|
|
|
`token_before` int unsigned DEFAULT NULL COMMENT '优化前Token数',
|
|
|
`token_after` int unsigned DEFAULT NULL COMMENT '优化后Token数',
|
|
|
`operator_id` bigint unsigned DEFAULT NULL COMMENT '操作用户ID',
|
|
|
`is_security_change` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否涉及安全规则变更',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `operator_id` (`operator_id`),
|
|
|
KEY `idx_agent_version` (`agent_id`,`created_at`),
|
|
|
CONSTRAINT `agent_config_versions_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `agent_config_versions_ibfk_2` FOREIGN KEY (`operator_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Agent配置版本快照表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `agent_config_versions`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `agent_config_versions` WRITE;
|
|
|
/*!40000 ALTER TABLE `agent_config_versions` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `agent_config_versions` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `agent_memory_rules`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `agent_memory_rules`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `agent_memory_rules` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`agent_id` bigint unsigned NOT NULL COMMENT '关联Agent',
|
|
|
`rule_category` enum('security','resource','environment','execution','experience','custom') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则类别',
|
|
|
`custom_category_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '自定义类别名称(rule_category=custom时使用)',
|
|
|
`rule_title` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则标题/摘要',
|
|
|
`rule_content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则详细内容',
|
|
|
`priority` smallint unsigned NOT NULL DEFAULT '50' COMMENT '优先级(0最高,越小越高)',
|
|
|
`is_enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用(安全规则不可禁用)',
|
|
|
`is_deletable` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否可删除',
|
|
|
`is_compressible` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否可压缩',
|
|
|
`source` enum('manual','agent_generated','system') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'manual' COMMENT '规则来源',
|
|
|
`expires_at` datetime DEFAULT NULL COMMENT '过期时间(经验规则30天未更新自动标记)',
|
|
|
`status` enum('active','pending_verify','archived') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
|
|
|
`last_verified_at` datetime DEFAULT NULL COMMENT '最后验证时间',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_agent_category` (`agent_id`,`rule_category`),
|
|
|
KEY `idx_priority` (`agent_id`,`priority`),
|
|
|
CONSTRAINT `agent_memory_rules_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`) ON DELETE CASCADE
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Agent纪律约束规则表(memory.md)';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `agent_memory_rules`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `agent_memory_rules` WRITE;
|
|
|
/*!40000 ALTER TABLE `agent_memory_rules` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `agent_memory_rules` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `agent_soul_configs`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `agent_soul_configs`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `agent_soul_configs` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`agent_id` bigint unsigned NOT NULL COMMENT '关联Agent',
|
|
|
`role_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色名称',
|
|
|
`role_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色类型:文本分析/数据采集/信息检索/安全审查 等',
|
|
|
`duty_scope` text COLLATE utf8mb4_unicode_ci COMMENT '职责范围与能力边界',
|
|
|
`interaction_style` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '交互风格:简洁执行者/分析顾问 等',
|
|
|
`allowed_skills` json DEFAULT NULL COMMENT '授权调用的Skill类别列表',
|
|
|
`soul_markdown` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'soul.md 完整Markdown内容',
|
|
|
`token_count` int unsigned DEFAULT NULL COMMENT '当前soul.md Token数量',
|
|
|
`current_version_id` bigint unsigned DEFAULT NULL COMMENT '指向最新版本快照ID(外键延后设置)',
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `agent_id` (`agent_id`),
|
|
|
KEY `fk_soul_current_version` (`current_version_id`),
|
|
|
CONSTRAINT `agent_soul_configs_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `fk_soul_current_version` FOREIGN KEY (`current_version_id`) REFERENCES `agent_config_versions` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Agent角色定位配置(soul.md)';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `agent_soul_configs`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `agent_soul_configs` WRITE;
|
|
|
/*!40000 ALTER TABLE `agent_soul_configs` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `agent_soul_configs` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `agents`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `agents`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `agents` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'AgentID',
|
|
|
`agent_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Agent唯一代号,如 a1-qwen-summarize',
|
|
|
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Agent显示名称',
|
|
|
`provider` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '提供方/来源单位',
|
|
|
`category` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能力分类,如:大语言模型/计算机视觉',
|
|
|
`description` text COLLATE utf8mb4_unicode_ci COMMENT '功能描述',
|
|
|
`api_endpoint` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Agent API 调用端点 (相对路径或完整URL)',
|
|
|
`api_method` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POST' COMMENT 'HTTP方法',
|
|
|
`tags` json DEFAULT NULL COMMENT '标签列表 ["情报","摘要"]',
|
|
|
`usage_count` int unsigned NOT NULL DEFAULT '0' COMMENT '累计调用次数',
|
|
|
`is_public` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否在智能体广场公开',
|
|
|
`owner_id` bigint unsigned DEFAULT NULL COMMENT '上传者用户ID (NULL=系统内置)',
|
|
|
`team_id` bigint unsigned DEFAULT NULL COMMENT '所属团队ID (NULL=公共广场)',
|
|
|
`status` enum('active','inactive','deprecated') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `agent_code` (`agent_code`),
|
|
|
KEY `team_id` (`team_id`),
|
|
|
KEY `idx_category` (`category`),
|
|
|
KEY `idx_owner` (`owner_id`),
|
|
|
FULLTEXT KEY `ft_name_desc` (`name`,`description`),
|
|
|
CONSTRAINT `agents_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
|
|
CONSTRAINT `agents_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Agent智能体基础信息表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `agents`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `agents` WRITE;
|
|
|
/*!40000 ALTER TABLE `agents` DISABLE KEYS */;
|
|
|
INSERT INTO `agents` VALUES (1,'a1-qwen-summarize','Qwen3.5 军事情报摘要','本地大模型中台','大语言模型','基于Qwen3.5对军事情报文本进行智能摘要,自动提取关键目标、时间、地点信息','/api/v1/agents/invoke','POST',NULL,1205,1,NULL,NULL,'active','2026-04-15 19:14:37','2026-04-15 19:14:37'),(2,'a2-cv-target-detect','高空侦察目标实时识别','视觉分析中心','计算机视觉','针对无人机高空图像进行实时目标检测,支持多目标跟踪与威胁等级分类','/api/v1/agents/invoke','POST',NULL,856,1,NULL,NULL,'active','2026-04-15 19:14:37','2026-04-15 19:14:37'),(3,'a3-db-statistics','数据库统计分析','数据管理中心','数据分析','对接结构化数据库,执行周期性统计查询,生成装备完好率/任务完成率等指标报告','/api/v1/agents/invoke','POST',NULL,423,1,NULL,NULL,'active','2026-04-15 19:14:37','2026-04-15 19:14:37'),(4,'a4-drone-dispatch','无人机调度API','无人平台控制中心','指令控制','通过标准化接口下发无人机巡逻路线、目标标记及返航指令','/api/v1/agents/invoke','POST',NULL,312,1,NULL,NULL,'active','2026-04-15 19:14:37','2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `agents` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `ai_engines`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `ai_engines`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `ai_engines` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`engine_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '引擎类型:ollama/dify/openclaw',
|
|
|
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '显示名称',
|
|
|
`endpoint` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '服务地址,如 http://localhost:11434',
|
|
|
`description` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '描述,如"已挂载4x RTX 3090"',
|
|
|
`status` enum('ready','offline','error') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offline',
|
|
|
`last_checked_at` datetime DEFAULT NULL COMMENT '最后一次健康检查时间',
|
|
|
`config_json` json DEFAULT NULL COMMENT '附加配置(模型列表/端口等)',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`)
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='本地AI引擎注册表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `ai_engines`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `ai_engines` WRITE;
|
|
|
/*!40000 ALTER TABLE `ai_engines` DISABLE KEYS */;
|
|
|
INSERT INTO `ai_engines` VALUES (1,'ollama','Ollama 离线大模型推理框架','http://localhost:11434','已挂载 4x RTX 3090','ready',NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(2,'openclaw','OpenClaw Gateway','http://localhost:18789','任务调度与Skill执行引擎','ready',NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(3,'dify','Dify AI 开发中台','http://localhost:8080','v0.6.x 微服务集群','ready',NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `ai_engines` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `alert_notifications`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `alert_notifications`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `alert_notifications` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`target_user_id` bigint unsigned NOT NULL COMMENT '接收告警的用户ID',
|
|
|
`task_id` bigint unsigned DEFAULT NULL COMMENT '关联任务ID',
|
|
|
`execution_id` bigint unsigned DEFAULT NULL COMMENT '关联执行记录ID',
|
|
|
`alert_type` enum('task_fail','timeout','resource_exceed','system','custom') COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
|
`title` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '告警标题',
|
|
|
`content` text COLLATE utf8mb4_unicode_ci COMMENT '告警详情',
|
|
|
`is_read` tinyint(1) NOT NULL DEFAULT '0',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `task_id` (`task_id`),
|
|
|
KEY `execution_id` (`execution_id`),
|
|
|
KEY `idx_user_unread` (`target_user_id`,`is_read`,`created_at` DESC),
|
|
|
CONSTRAINT `alert_notifications_ibfk_1` FOREIGN KEY (`target_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `alert_notifications_ibfk_2` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE SET NULL,
|
|
|
CONSTRAINT `alert_notifications_ibfk_3` FOREIGN KEY (`execution_id`) REFERENCES `task_executions` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统告警与通知表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `alert_notifications`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `alert_notifications` WRITE;
|
|
|
/*!40000 ALTER TABLE `alert_notifications` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `alert_notifications` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `daily_stats`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `daily_stats`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `daily_stats` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`stat_date` date NOT NULL COMMENT '统计日期',
|
|
|
`user_id` bigint unsigned DEFAULT NULL COMMENT '用户ID(NULL=全局)',
|
|
|
`total_executions` int unsigned NOT NULL DEFAULT '0' COMMENT '当日总执行次数',
|
|
|
`success_count` int unsigned NOT NULL DEFAULT '0',
|
|
|
`fail_count` int unsigned NOT NULL DEFAULT '0',
|
|
|
`timeout_count` int unsigned NOT NULL DEFAULT '0',
|
|
|
`avg_duration_ms` int unsigned DEFAULT NULL COMMENT '平均耗时(毫秒)',
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `uk_date_user` (`stat_date`,`user_id`),
|
|
|
KEY `user_id` (`user_id`),
|
|
|
CONSTRAINT `daily_stats_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='每日任务执行统计快照(供工作台图表)';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `daily_stats`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `daily_stats` WRITE;
|
|
|
/*!40000 ALTER TABLE `daily_stats` DISABLE KEYS */;
|
|
|
INSERT INTO `daily_stats` VALUES (1,'2026-04-09',1,12,11,1,0,1200),(2,'2026-04-10',1,18,17,1,0,1100),(3,'2026-04-11',1,15,15,0,0,980),(4,'2026-04-12',1,22,20,2,0,1350),(5,'2026-04-13',1,19,18,1,0,1050),(6,'2026-04-14',1,25,24,1,0,1080),(7,'2026-04-15',1,20,19,1,0,1150);
|
|
|
/*!40000 ALTER TABLE `daily_stats` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `datasources`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `datasources`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `datasources` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '数据源ID',
|
|
|
`owner_id` bigint unsigned NOT NULL COMMENT '所属用户ID',
|
|
|
`team_id` bigint unsigned DEFAULT NULL COMMENT '所属团队ID(NULL=个人私有)',
|
|
|
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据源名称,如"核心战情数据库(MySQL)"',
|
|
|
`ds_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据源类型:mysql/postgresql/redis/http_api/file 等',
|
|
|
`host` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '主机地址+端口,如 192.168.1.100:3306',
|
|
|
`database_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '数据库名',
|
|
|
`username` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户名(明文,保存时由后端加密)',
|
|
|
`credential_enc` text COLLATE utf8mb4_unicode_ci COMMENT 'AES-256加密后的密码/Token密文',
|
|
|
`extra_config` json DEFAULT NULL COMMENT '额外连接参数(SSL/连接池大小等)',
|
|
|
`connection_status` enum('ok','error','unknown') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'unknown' COMMENT '连通测试结果',
|
|
|
`last_tested_at` datetime DEFAULT NULL COMMENT '最后一次连通测试时间',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `team_id` (`team_id`),
|
|
|
KEY `idx_owner` (`owner_id`),
|
|
|
CONSTRAINT `datasources_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `datasources_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='数据源与外部凭证表(密码AES-256加密存储)';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `datasources`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `datasources` WRITE;
|
|
|
/*!40000 ALTER TABLE `datasources` DISABLE KEYS */;
|
|
|
INSERT INTO `datasources` VALUES (1,1,1,'核心战情数据库 (MySQL)','mysql','192.168.1.100:3306','lingshu','db_admin','cGxhY2Vob2xkZXI=',NULL,'ok',NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `datasources` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `plaza_ratings`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `plaza_ratings`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `plaza_ratings` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`resource_type` enum('task_template','agent') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '资源类型',
|
|
|
`resource_id` bigint unsigned NOT NULL COMMENT '资源ID',
|
|
|
`user_id` bigint unsigned NOT NULL,
|
|
|
`rating` tinyint unsigned DEFAULT NULL COMMENT '评分 1-5',
|
|
|
`is_favorite` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否收藏',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `uk_user_resource` (`resource_type`,`resource_id`,`user_id`),
|
|
|
KEY `user_id` (`user_id`),
|
|
|
CONSTRAINT `plaza_ratings_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='广场资源评分与收藏表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `plaza_ratings`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `plaza_ratings` WRITE;
|
|
|
/*!40000 ALTER TABLE `plaza_ratings` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `plaza_ratings` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `skills`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `skills`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `skills` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'SkillID',
|
|
|
`skill_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Skill唯一标识,如 text_summarize',
|
|
|
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Skill显示名称',
|
|
|
`category` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Skill类别:文本分析/图像处理/数据采集/指令下发 等',
|
|
|
`description` text COLLATE utf8mb4_unicode_ci COMMENT '功能描述',
|
|
|
`input_schema` json DEFAULT NULL COMMENT '输入参数JSON Schema',
|
|
|
`output_schema` json DEFAULT NULL COMMENT '输出参数JSON Schema',
|
|
|
`owner_id` bigint unsigned DEFAULT NULL COMMENT '创建者用户ID',
|
|
|
`team_id` bigint unsigned DEFAULT NULL COMMENT '所属团队ID (NULL=全局公共)',
|
|
|
`is_public` tinyint(1) NOT NULL DEFAULT '1',
|
|
|
`usage_count` int unsigned NOT NULL DEFAULT '0',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `skill_code` (`skill_code`),
|
|
|
KEY `owner_id` (`owner_id`),
|
|
|
KEY `team_id` (`team_id`),
|
|
|
CONSTRAINT `skills_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
|
|
CONSTRAINT `skills_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Skill技能定义表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `skills`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `skills` WRITE;
|
|
|
/*!40000 ALTER TABLE `skills` DISABLE KEYS */;
|
|
|
INSERT INTO `skills` VALUES (1,'text_summarize','文本摘要','文本分析','调用LLM对输入文本进行摘要压缩',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(2,'image_detect','图像目标检测','图像处理','对图像帧进行实时目标检测并返回坐标与置信度',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(3,'db_query','数据库查询','数据采集','执行SQL查询并返回结构化结果',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(4,'db_write','数据库写入','数据存储','将结果数据写入指定数据库表',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(5,'send_notification','发送通知','指令下发','通过企业微信/邮件/系统消息推送告警或报告',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(6,'file_archive','数据归档','文件处理','将执行结果序列化并归档到指定路径',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(7,'drone_command','无人机指令下发','指令控制','调用无人机控制API下发路线或动作指令',NULL,NULL,NULL,NULL,1,0,'2026-04-15 19:14:37','2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `skills` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `task_executions`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `task_executions`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `task_executions` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '执行记录ID',
|
|
|
`task_id` bigint unsigned NOT NULL COMMENT '关联任务ID',
|
|
|
`trigger_type` enum('cron','manual','webhook') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '本次触发方式',
|
|
|
`trigger_user_id` bigint unsigned DEFAULT NULL COMMENT '手动触发的用户ID(定时触发为NULL)',
|
|
|
`status` enum('pending','running','success','failed','timeout') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
|
|
|
`started_at` datetime DEFAULT NULL COMMENT '实际开始时间',
|
|
|
`ended_at` datetime DEFAULT NULL COMMENT '实际结束时间',
|
|
|
`duration_ms` int unsigned DEFAULT NULL COMMENT '执行耗时(毫秒)',
|
|
|
`input_params` json DEFAULT NULL COMMENT '本次执行的输入参数快照',
|
|
|
`output_result` json DEFAULT NULL COMMENT '执行输出结果',
|
|
|
`error_message` text COLLATE utf8mb4_unicode_ci COMMENT '失败时的错误信息',
|
|
|
`retry_attempt` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '当前是第几次重试(0=首次)',
|
|
|
`openclaw_job_id` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'OpenClaw调度引擎返回的任务ID',
|
|
|
`cpu_usage_pct` decimal(5,2) DEFAULT NULL COMMENT '执行期间CPU使用率峰值(%)',
|
|
|
`memory_usage_pct` decimal(5,2) DEFAULT NULL COMMENT '执行期间内存使用率峰值(%)',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_task_status` (`task_id`,`status`),
|
|
|
KEY `idx_task_time` (`task_id`,`started_at` DESC),
|
|
|
KEY `trigger_user_id` (`trigger_user_id`),
|
|
|
CONSTRAINT `task_executions_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `task_executions_ibfk_2` FOREIGN KEY (`trigger_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='任务执行记录表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `task_executions`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `task_executions` WRITE;
|
|
|
/*!40000 ALTER TABLE `task_executions` DISABLE KEYS */;
|
|
|
INSERT INTO `task_executions` VALUES (1,1,'cron',NULL,'success','2026-04-15 17:14:37','2026-04-15 17:14:38',1150,NULL,NULL,NULL,0,NULL,42.50,68.30,'2026-04-15 19:14:37'),(2,1,'cron',NULL,'success','2026-04-15 15:14:37','2026-04-15 15:14:38',1080,NULL,NULL,NULL,0,NULL,38.20,65.10,'2026-04-15 19:14:37'),(3,1,'cron',NULL,'failed','2026-04-15 13:14:37','2026-04-15 13:14:42',NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,'2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `task_executions` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `task_logs`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `task_logs`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `task_logs` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`execution_id` bigint unsigned NOT NULL COMMENT '关联执行记录ID',
|
|
|
`task_id` bigint unsigned NOT NULL COMMENT '冗余任务ID便于快速查询',
|
|
|
`log_level` enum('info','warn','error','success','debug') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'info',
|
|
|
`log_time` datetime(3) NOT NULL COMMENT '日志时间(精确到毫秒)',
|
|
|
`message` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '日志内容',
|
|
|
`node_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '产生日志的工作流节点名称',
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_exec` (`execution_id`,`log_time`),
|
|
|
KEY `idx_task_level` (`task_id`,`log_level`),
|
|
|
CONSTRAINT `task_logs_ibfk_1` FOREIGN KEY (`execution_id`) REFERENCES `task_executions` (`id`) ON DELETE CASCADE
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='任务执行日志表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `task_logs`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `task_logs` WRITE;
|
|
|
/*!40000 ALTER TABLE `task_logs` DISABLE KEYS */;
|
|
|
INSERT INTO `task_logs` VALUES (1,3,1,'info','2026-04-15 17:14:37.000','Task Workflow Triggered','Cron定时触发'),(2,3,1,'info','2026-04-15 17:14:38.000','Initializing node context... OK','Cron定时触发'),(3,3,1,'info','2026-04-15 17:14:39.000','Fetching UAV data stream... 32 frames','图像目标检测'),(4,3,1,'info','2026-04-15 17:14:40.000','Invoking Vision AI Agent (CV-Model)...','图像目标检测'),(5,3,1,'success','2026-04-15 17:14:41.000','Agent analysis complete. Targets found: 2','图像目标检测'),(6,3,1,'info','2026-04-15 17:14:42.000','Writing results to database...','写入数据库'),(7,3,1,'success','2026-04-15 17:14:43.000','Task workflow finished in 1.15 seconds','写入数据库');
|
|
|
/*!40000 ALTER TABLE `task_logs` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `task_templates`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `task_templates`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `task_templates` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '模板ID',
|
|
|
`title` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板名称',
|
|
|
`description` text COLLATE utf8mb4_unicode_ci COMMENT '模板说明',
|
|
|
`category` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '分类:情报处理/装备监控/侦察任务/后勤统计/指挥简报',
|
|
|
`tags` json DEFAULT NULL COMMENT '标签列表',
|
|
|
`contributor_id` bigint unsigned NOT NULL COMMENT '贡献者用户ID',
|
|
|
`contributor_alias` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '贡献者展示昵称(发布时自填)',
|
|
|
`task_config` json NOT NULL COMMENT '模板任务配置快照(名称/cron/skill参数/workflow_json等)',
|
|
|
`usage_count` int unsigned NOT NULL DEFAULT '0' COMMENT '被导入次数',
|
|
|
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否在广场展示',
|
|
|
`published_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间',
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `contributor_id` (`contributor_id`),
|
|
|
KEY `idx_category` (`category`),
|
|
|
KEY `idx_usage` (`usage_count` DESC),
|
|
|
FULLTEXT KEY `ft_title_desc` (`title`,`description`),
|
|
|
CONSTRAINT `task_templates_ibfk_1` FOREIGN KEY (`contributor_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='任务模板广场表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `task_templates`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `task_templates` WRITE;
|
|
|
/*!40000 ALTER TABLE `task_templates` DISABLE KEYS */;
|
|
|
INSERT INTO `task_templates` VALUES (1,'每日天气预报 [模板]','自动处理数据,请导入后配置自身凭证。','情报处理',NULL,4,'小头兵','{}',0,1,'2026-04-15 20:27:14','2026-04-15 20:27:14');
|
|
|
/*!40000 ALTER TABLE `task_templates` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `tasks`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `tasks`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `tasks` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '任务ID',
|
|
|
`owner_id` bigint unsigned NOT NULL COMMENT '创建用户ID',
|
|
|
`team_id` bigint unsigned DEFAULT NULL COMMENT '所属团队ID(NULL=个人私有)',
|
|
|
`name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务名称',
|
|
|
`description` text COLLATE utf8mb4_unicode_ci COMMENT '任务描述',
|
|
|
`category` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '任务分类:情报处理/装备监控/侦察任务/后勤统计/指挥简报',
|
|
|
`trigger_type` enum('cron','manual','webhook') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'cron' COMMENT '触发方式',
|
|
|
`cron_expression` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Cron表达式,如 0 */2 * * *',
|
|
|
`cron_description` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Cron的自然语言描述',
|
|
|
`agent_id` bigint unsigned DEFAULT NULL COMMENT '主关联Agent ID',
|
|
|
`skill_id` bigint unsigned DEFAULT NULL COMMENT '主调用Skill ID',
|
|
|
`skill_params` json DEFAULT NULL COMMENT 'Skill输入参数配置(JSON)',
|
|
|
`datasource_id` bigint unsigned DEFAULT NULL COMMENT '绑定的数据源凭证ID',
|
|
|
`timeout_seconds` smallint unsigned NOT NULL DEFAULT '60' COMMENT '超时时间(秒)',
|
|
|
`retry_count` tinyint unsigned NOT NULL DEFAULT '3' COMMENT '失败重试次数',
|
|
|
`alert_on_fail` tinyint(1) NOT NULL DEFAULT '1' COMMENT '失败是否告警',
|
|
|
`status` enum('draft','stopped','running','error') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'stopped' COMMENT '任务状态',
|
|
|
`workflow_json` json DEFAULT NULL COMMENT 'Drawflow画布JSON序列化数据',
|
|
|
`source_template_id` bigint unsigned DEFAULT NULL COMMENT '从任务广场导入时的模板ID',
|
|
|
`published_template_id` bigint unsigned DEFAULT NULL COMMENT '已发布到广场的模板ID',
|
|
|
`last_run_at` datetime DEFAULT NULL COMMENT '最后一次执行时间',
|
|
|
`next_run_at` datetime DEFAULT NULL COMMENT '下次计划执行时间',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `agent_id` (`agent_id`),
|
|
|
KEY `skill_id` (`skill_id`),
|
|
|
KEY `idx_owner_status` (`owner_id`,`status`),
|
|
|
KEY `idx_team` (`team_id`),
|
|
|
FULLTEXT KEY `ft_name` (`name`),
|
|
|
CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
|
|
|
CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL,
|
|
|
CONSTRAINT `tasks_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`) ON DELETE SET NULL,
|
|
|
CONSTRAINT `tasks_ibfk_4` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='任务主表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `tasks`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `tasks` WRITE;
|
|
|
/*!40000 ALTER TABLE `tasks` DISABLE KEYS */;
|
|
|
INSERT INTO `tasks` VALUES (1,1,1,'边境巡逻无人机数据处理与告警',NULL,NULL,'cron','0 */2 * * *',NULL,2,NULL,NULL,NULL,60,3,1,'running',NULL,NULL,NULL,NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(2,1,1,'每日战备情报自动分发',NULL,NULL,'cron','0 6 * * *',NULL,1,NULL,NULL,NULL,60,3,1,'running',NULL,NULL,NULL,NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(3,1,1,'某型装备健康度定时评估',NULL,NULL,'cron','0 0 * * 0',NULL,3,NULL,NULL,NULL,60,3,1,'stopped',NULL,NULL,NULL,NULL,NULL,'2026-04-15 19:14:37','2026-04-15 19:14:37'),(4,4,1,'每日天气预报',NULL,NULL,'cron','每天早上八点',NULL,NULL,NULL,NULL,NULL,60,3,1,'stopped','{\"timeout\": 300, \"category\": \"\", \"skill_name\": \"文件推送\", \"description\": \"推送每天天气\", \"retry_count\": 3, \"skill_params\": {}, \"datasource_id\": null}',NULL,NULL,NULL,NULL,'2026-04-15 20:27:09','2026-04-15 20:27:09');
|
|
|
/*!40000 ALTER TABLE `tasks` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `team_audit_logs`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `team_audit_logs`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `team_audit_logs` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`team_id` bigint unsigned NOT NULL,
|
|
|
`user_id` bigint unsigned NOT NULL COMMENT '操作人',
|
|
|
`action` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作描述,如"创建了任务「...」"',
|
|
|
`resource_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作对象类型',
|
|
|
`resource_id` bigint unsigned DEFAULT NULL COMMENT '操作对象ID',
|
|
|
`ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作者IP',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `user_id` (`user_id`),
|
|
|
KEY `idx_team_time` (`team_id`,`created_at` DESC),
|
|
|
CONSTRAINT `team_audit_logs_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `team_audit_logs_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='团队操作审计日志表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `team_audit_logs`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `team_audit_logs` WRITE;
|
|
|
/*!40000 ALTER TABLE `team_audit_logs` DISABLE KEYS */;
|
|
|
INSERT INTO `team_audit_logs` VALUES (1,1,1,'创建了任务「边境巡逻无人机数据处理与告警」','task',NULL,NULL,'2026-04-15 19:14:37'),(2,1,2,'修改了流程编排「情报分发流程」','task',NULL,NULL,'2026-04-15 19:14:37'),(3,1,3,'查看了监控日志','task_log',NULL,NULL,'2026-04-15 19:14:37'),(4,1,1,'发布了模板到任务广场','task_template',NULL,NULL,'2026-04-15 19:14:37'),(5,1,2,'启动了任务「每日战备情报自动分发」','task',NULL,NULL,'2026-04-15 19:14:37'),(6,1,4,'创建了任务「每日天气预报」','task',4,NULL,'2026-04-15 20:27:09');
|
|
|
/*!40000 ALTER TABLE `team_audit_logs` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `team_comments`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `team_comments`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `team_comments` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`team_id` bigint unsigned NOT NULL,
|
|
|
`user_id` bigint unsigned NOT NULL COMMENT '发言者',
|
|
|
`parent_id` bigint unsigned DEFAULT NULL COMMENT '回复的评论ID(NULL=顶级留言)',
|
|
|
`content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '留言内容',
|
|
|
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `user_id` (`user_id`),
|
|
|
KEY `parent_id` (`parent_id`),
|
|
|
KEY `idx_team_time` (`team_id`,`created_at`),
|
|
|
CONSTRAINT `team_comments_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `team_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
|
|
|
CONSTRAINT `team_comments_ibfk_3` FOREIGN KEY (`parent_id`) REFERENCES `team_comments` (`id`) ON DELETE SET NULL
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='团队讨论留言表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `team_comments`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `team_comments` WRITE;
|
|
|
/*!40000 ALTER TABLE `team_comments` DISABLE KEYS */;
|
|
|
INSERT INTO `team_comments` VALUES (1,1,2,NULL,'今天的情报摘要格式需要调整一下,加上来源标注。',0,'2026-04-15 19:14:37'),(2,1,1,NULL,'已修改模板,增加了一个来源字段节点。',0,'2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `team_comments` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `team_members`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `team_members`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `team_members` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`team_id` bigint unsigned NOT NULL COMMENT '团队ID',
|
|
|
`user_id` bigint unsigned NOT NULL COMMENT '用户ID',
|
|
|
`role` enum('admin','editor','viewer') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'viewer' COMMENT '成员角色',
|
|
|
`is_online` tinyint(1) NOT NULL DEFAULT '0' COMMENT '当前是否在线(心跳更新)',
|
|
|
`joined_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '加入时间',
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `uk_team_user` (`team_id`,`user_id`),
|
|
|
KEY `idx_user` (`user_id`),
|
|
|
CONSTRAINT `team_members_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `team_members_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='团队成员表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `team_members`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `team_members` WRITE;
|
|
|
/*!40000 ALTER TABLE `team_members` DISABLE KEYS */;
|
|
|
INSERT INTO `team_members` VALUES (4,1,4,'viewer',0,'2026-04-15 19:31:49');
|
|
|
/*!40000 ALTER TABLE `team_members` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `team_shared_resources`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `team_shared_resources`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `team_shared_resources` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
|
`team_id` bigint unsigned NOT NULL,
|
|
|
`resource_type` enum('task_template','agent','skill','datasource') COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
|
`resource_id` bigint unsigned NOT NULL COMMENT '对应各资源表的ID',
|
|
|
`resource_name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '冗余资源名称,方便展示',
|
|
|
`shared_by` bigint unsigned NOT NULL COMMENT '共享操作者用户ID',
|
|
|
`usage_count` int unsigned NOT NULL DEFAULT '0' COMMENT '团队内使用次数',
|
|
|
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
|
|
`shared_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `uk_team_resource` (`team_id`,`resource_type`,`resource_id`),
|
|
|
KEY `shared_by` (`shared_by`),
|
|
|
CONSTRAINT `team_shared_resources_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE,
|
|
|
CONSTRAINT `team_shared_resources_ibfk_2` FOREIGN KEY (`shared_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='团队共享资源表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `team_shared_resources`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `team_shared_resources` WRITE;
|
|
|
/*!40000 ALTER TABLE `team_shared_resources` DISABLE KEYS */;
|
|
|
/*!40000 ALTER TABLE `team_shared_resources` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `teams`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `teams`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `teams` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '团队ID',
|
|
|
`team_code` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '团队隔离空间ID,如 T-9082',
|
|
|
`team_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '团队名称',
|
|
|
`description` text COLLATE utf8mb4_unicode_ci COMMENT '团队简介',
|
|
|
`owner_id` bigint unsigned NOT NULL COMMENT '创建者/管理员用户ID',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `team_code` (`team_code`),
|
|
|
KEY `idx_owner` (`owner_id`),
|
|
|
CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='团队表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `teams`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `teams` WRITE;
|
|
|
/*!40000 ALTER TABLE `teams` DISABLE KEYS */;
|
|
|
INSERT INTO `teams` VALUES (1,'T-9082','灵枢作战团队','负责全域智能任务编排与情报处理',1,'2026-04-15 19:14:37','2026-04-15 19:14:37');
|
|
|
/*!40000 ALTER TABLE `teams` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Table structure for table `users`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `users`;
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
CREATE TABLE `users` (
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
|
|
`username` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '登录用户名',
|
|
|
`display_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '显示姓名/职务',
|
|
|
`password_hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'bcrypt哈希密码',
|
|
|
`avatar_color` char(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#3b82f6' COMMENT '头像背景色(十六进制)',
|
|
|
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '账号是否启用',
|
|
|
`last_login_at` datetime DEFAULT NULL COMMENT '最后登录时间',
|
|
|
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `username` (`username`),
|
|
|
KEY `idx_username` (`username`)
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';
|
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
|
|
--
|
|
|
-- Dumping data for table `users`
|
|
|
--
|
|
|
|
|
|
LOCK TABLES `users` WRITE;
|
|
|
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
|
|
INSERT INTO `users` VALUES (1,'wangpai','王牌参谋','$2b$12$OA1rvEsgDgUYhbf/bN/aLemddJfoirHMW6T7Y9IJfRPvqf2W.9ixW','#3b82f6',1,NULL,'2026-04-15 19:14:37','2026-04-15 19:30:41'),(2,'liming','李明','$2b$12$Xcdlvf3TWErEmx66gOW/XuMbDktGEe.8y6wxcsrV1aNzCuRt.hA/y','#8b5cf6',1,NULL,'2026-04-15 19:14:37','2026-04-15 19:30:41'),(3,'zhaoqiang','赵强','$2b$12$ojsmrfaYTftpmxN/kAumCushmIoqARLiD0RHns/b8jnx4J3WIiCYO','#10b981',1,NULL,'2026-04-15 19:14:37','2026-04-15 19:30:41'),(4,'1+','小头兵','$2b$12$cjgVOBMUBCCQ1kZzbL/CIOG.ufLXYIJ4ywD5vketHg2RmFBs2e7MW','#3b82f6',1,NULL,'2026-04-15 19:31:49','2026-04-15 19:31:49');
|
|
|
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
--
|
|
|
-- Temporary view structure for view `v_dashboard_kpi`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `v_dashboard_kpi`;
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_dashboard_kpi`*/;
|
|
|
SET @saved_cs_client = @@character_set_client;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 CREATE VIEW `v_dashboard_kpi` AS SELECT
|
|
|
1 AS `owner_id`,
|
|
|
1 AS `total_tasks`,
|
|
|
1 AS `running_tasks`,
|
|
|
1 AS `error_tasks`,
|
|
|
1 AS `monthly_executions`,
|
|
|
1 AS `unread_alerts`*/;
|
|
|
SET character_set_client = @saved_cs_client;
|
|
|
|
|
|
--
|
|
|
-- Temporary view structure for view `v_recent_executions`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `v_recent_executions`;
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_recent_executions`*/;
|
|
|
SET @saved_cs_client = @@character_set_client;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 CREATE VIEW `v_recent_executions` AS SELECT
|
|
|
1 AS `id`,
|
|
|
1 AS `task_id`,
|
|
|
1 AS `trigger_type`,
|
|
|
1 AS `status`,
|
|
|
1 AS `started_at`,
|
|
|
1 AS `ended_at`,
|
|
|
1 AS `duration_ms`,
|
|
|
1 AS `retry_attempt`,
|
|
|
1 AS `error_message`,
|
|
|
1 AS `task_name`,
|
|
|
1 AS `trigger_user`*/;
|
|
|
SET character_set_client = @saved_cs_client;
|
|
|
|
|
|
--
|
|
|
-- Temporary view structure for view `v_tasks_full`
|
|
|
--
|
|
|
|
|
|
DROP TABLE IF EXISTS `v_tasks_full`;
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_tasks_full`*/;
|
|
|
SET @saved_cs_client = @@character_set_client;
|
|
|
/*!50503 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 CREATE VIEW `v_tasks_full` AS SELECT
|
|
|
1 AS `id`,
|
|
|
1 AS `name`,
|
|
|
1 AS `description`,
|
|
|
1 AS `category`,
|
|
|
1 AS `trigger_type`,
|
|
|
1 AS `cron_expression`,
|
|
|
1 AS `status`,
|
|
|
1 AS `timeout_seconds`,
|
|
|
1 AS `retry_count`,
|
|
|
1 AS `last_run_at`,
|
|
|
1 AS `next_run_at`,
|
|
|
1 AS `created_at`,
|
|
|
1 AS `updated_at`,
|
|
|
1 AS `owner_name`,
|
|
|
1 AS `agent_name`,
|
|
|
1 AS `agent_code`,
|
|
|
1 AS `skill_name`,
|
|
|
1 AS `team_name`*/;
|
|
|
SET character_set_client = @saved_cs_client;
|
|
|
|
|
|
--
|
|
|
-- Final view structure for view `v_dashboard_kpi`
|
|
|
--
|
|
|
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_dashboard_kpi`*/;
|
|
|
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
|
|
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
|
|
/*!50001 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 SET character_set_results = utf8mb4 */;
|
|
|
/*!50001 SET collation_connection = utf8mb4_0900_ai_ci */;
|
|
|
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
|
|
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
|
|
/*!50001 VIEW `v_dashboard_kpi` AS select `t`.`owner_id` AS `owner_id`,count(`t`.`id`) AS `total_tasks`,sum((`t`.`status` = 'running')) AS `running_tasks`,sum((`t`.`status` = 'error')) AS `error_tasks`,(select count(0) from (`task_executions` `e2` join `tasks` `t2` on((`e2`.`task_id` = `t2`.`id`))) where ((`t2`.`owner_id` = `t`.`owner_id`) and (month(`e2`.`started_at`) = month(curdate())) and (year(`e2`.`started_at`) = year(curdate())))) AS `monthly_executions`,(select count(0) from `alert_notifications` `an` where ((`an`.`target_user_id` = `t`.`owner_id`) and (`an`.`is_read` = 0))) AS `unread_alerts` from `tasks` `t` group by `t`.`owner_id` */;
|
|
|
/*!50001 SET character_set_client = @saved_cs_client */;
|
|
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
|
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
|
|
|
|
|
--
|
|
|
-- Final view structure for view `v_recent_executions`
|
|
|
--
|
|
|
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_recent_executions`*/;
|
|
|
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
|
|
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
|
|
/*!50001 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 SET character_set_results = utf8mb4 */;
|
|
|
/*!50001 SET collation_connection = utf8mb4_0900_ai_ci */;
|
|
|
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
|
|
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
|
|
/*!50001 VIEW `v_recent_executions` AS select `e`.`id` AS `id`,`e`.`task_id` AS `task_id`,`e`.`trigger_type` AS `trigger_type`,`e`.`status` AS `status`,`e`.`started_at` AS `started_at`,`e`.`ended_at` AS `ended_at`,`e`.`duration_ms` AS `duration_ms`,`e`.`retry_attempt` AS `retry_attempt`,`e`.`error_message` AS `error_message`,`t`.`name` AS `task_name`,`u`.`display_name` AS `trigger_user` from ((`task_executions` `e` left join `tasks` `t` on((`e`.`task_id` = `t`.`id`))) left join `users` `u` on((`e`.`trigger_user_id` = `u`.`id`))) order by `e`.`started_at` desc */;
|
|
|
/*!50001 SET character_set_client = @saved_cs_client */;
|
|
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
|
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
|
|
|
|
|
--
|
|
|
-- Final view structure for view `v_tasks_full`
|
|
|
--
|
|
|
|
|
|
/*!50001 DROP VIEW IF EXISTS `v_tasks_full`*/;
|
|
|
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
|
|
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
|
|
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
|
|
/*!50001 SET character_set_client = utf8mb4 */;
|
|
|
/*!50001 SET character_set_results = utf8mb4 */;
|
|
|
/*!50001 SET collation_connection = utf8mb4_0900_ai_ci */;
|
|
|
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
|
|
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
|
|
/*!50001 VIEW `v_tasks_full` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`description` AS `description`,`t`.`category` AS `category`,`t`.`trigger_type` AS `trigger_type`,`t`.`cron_expression` AS `cron_expression`,`t`.`status` AS `status`,`t`.`timeout_seconds` AS `timeout_seconds`,`t`.`retry_count` AS `retry_count`,`t`.`last_run_at` AS `last_run_at`,`t`.`next_run_at` AS `next_run_at`,`t`.`created_at` AS `created_at`,`t`.`updated_at` AS `updated_at`,`u`.`display_name` AS `owner_name`,`a`.`name` AS `agent_name`,`a`.`agent_code` AS `agent_code`,`s`.`name` AS `skill_name`,`tm`.`team_name` AS `team_name` from ((((`tasks` `t` left join `users` `u` on((`t`.`owner_id` = `u`.`id`))) left join `agents` `a` on((`t`.`agent_id` = `a`.`id`))) left join `skills` `s` on((`t`.`skill_id` = `s`.`id`))) left join `teams` `tm` on((`t`.`team_id` = `tm`.`id`))) */;
|
|
|
/*!50001 SET character_set_client = @saved_cs_client */;
|
|
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
|
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
|
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
|
|
|
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
|
|
|
|
-- Dump completed on 2026-04-15 20:32:34
|