/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80041
 Source Host           : localhost:3306
 Source Schema         : vwed_task

 Target Server Type    : MySQL
 Target Server Version : 80041
 File Encoding         : 65001

 Date: 12/10/2025 10:34:30
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for vwed_tasklog
-- ----------------------------
DROP TABLE IF EXISTS `vwed_tasklog`;
CREATE TABLE `vwed_tasklog`  (
  `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志记录ID',
  `level` int NULL DEFAULT NULL COMMENT '日志级别（1: 信息, 3: 错误等）',
  `message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '日志消息内容',
  `task_block_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务块名称(name字段)',
  `task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对应的任务定义ID',
  `task_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对应的任务执行记录ID',
  `parent_log_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父日志ID,用于建立层级关系',
  `iteration_index` int NULL DEFAULT NULL COMMENT '迭代索引,记录是第几次循环(从0开始)',
  `block_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联的块执行记录ID',
  `log_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日志类型: iteration_start(迭代开始), iteration_end(迭代结束), block_execution(块执行), branch_execution(分支执行)',
  `created_at` datetime(6) NULL DEFAULT NULL COMMENT '创建时间',
  `updated_at` datetime(6) NULL DEFAULT NULL COMMENT '更新时间',
  `is_deleted` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除（软删除标记）',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_vwed_tasklog_log_type`(`log_type` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_created_at`(`created_at` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_block_record_id`(`block_record_id` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_parent_log_id`(`parent_log_id` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_iteration_index`(`iteration_index` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_task_record_id`(`task_record_id` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_task_id`(`task_id` ASC) USING BTREE,
  INDEX `idx_vwed_tasklog_level`(`level` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of vwed_tasklog
-- ----------------------------
INSERT INTO `vwed_tasklog` VALUES ('b0e11167-1314-4921-a03a-2f1dec01cc69', 3, '{\"success\": false, \"message\": \"换机器人终止(未执行): 机器人损坏\", \"output\": {\"block_name\": \"b4\", \"block_type\": \"CAgvOperationBp\", \"terminated_at\": \"2025-10-12T10:33:31.364462\"}}', 'b4', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'e7191efc-4af9-4068-9d6c-cd421585d94e', NULL, NULL, 'aa01eec9-1516-4ee7-8611-f23cc702476b', 'block_execution', '2025-10-12 10:33:31.364462', '2025-10-12 10:33:31.364462', 0);
INSERT INTO `vwed_tasklog` VALUES ('b3641615-2774-4fac-a96f-fb019942f5c6', 3, '{\"success\": false, \"message\": \"换机器人终止: 机器人损坏\", \"output\": {\"block_name\": \"-1\", \"block_type\": \"RootBp\", \"terminated_at\": \"2025-10-12T10:33:31.362462\"}}', '-1', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'e7191efc-4af9-4068-9d6c-cd421585d94e', NULL, NULL, '647c57ad-519e-44e6-9241-647f3d23b70c', 'block_execution', '2025-10-12 10:33:31.363462', '2025-10-12 10:33:31.363462', 0);
INSERT INTO `vwed_tasklog` VALUES ('c6636ff6-0055-4c7f-ba71-8811a640acc6', 1, '{\"success\": true, \"message\": \"子块 5 执行失败: 选择执行机器人取消, 块id：b2\", \"block_id\": 5, \"is_canceled\": true, \"output\": {}}', '-1', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'e7191efc-4af9-4068-9d6c-cd421585d94e', NULL, NULL, '0ab3a7db-9351-473e-915d-8ab90ed0111f', 'block_execution', '2025-10-12 10:33:31.585568', '2025-10-12 10:33:31.585568', 0);
INSERT INTO `vwed_tasklog` VALUES ('eca194d4-9e32-4453-aa98-cedb832fd4cd', 1, '{\"success\": true, \"message\": \"选择机器人块成功, 块id：sw_1704fcf9\", \"output\": {\"selectedAgvId\": \"Fake-12\"}}', '-1', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'e7191efc-4af9-4068-9d6c-cd421585d94e', NULL, NULL, 'b3e4f8cd-12f7-4f14-9b55-5ff5b335af54', 'block_execution', '2025-10-12 10:33:33.047430', '2025-10-12 10:33:33.047430', 0);
INSERT INTO `vwed_tasklog` VALUES ('fbd5acf8-449a-4f05-874b-d7ec3cc525f3', 3, '{\"success\": false, \"message\": \"换机器人终止: 机器人损坏\", \"output\": {\"block_name\": \"b2\", \"block_type\": \"CSelectAgvBp\", \"terminated_at\": \"2025-10-12T10:33:31.361463\"}}', 'b2', '571985c1-cfa5-4186-8acd-6e3868a5e08c', 'e7191efc-4af9-4068-9d6c-cd421585d94e', NULL, NULL, '0ab3a7db-9351-473e-915d-8ab90ed0111f', 'block_execution', '2025-10-12 10:33:31.362462', '2025-10-12 10:33:31.362462', 0);

SET FOREIGN_KEY_CHECKS = 1;
