SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE IF NOT EXISTS `omc_db`.`chart_graph` (
  `row_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
  `row_type` enum('node','edge','combo') NOT NULL COMMENT '记录类型',
  `row_group` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '记录组名',
  `id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '元素ID',
  `type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'node/combo 类型',
  `depth` int DEFAULT '0' COMMENT 'node/combo 深度',
  `x` float DEFAULT '0' COMMENT 'node/combo 横向坐标',
  `y` float DEFAULT '0' COMMENT 'node/combo 纵向坐标',
  `size` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '30' COMMENT 'node/combo 大小-JSON数组',
  `icon` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'node-部分类型支持图标JSON配置',
  `img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'node-img 图片',
  `clip_cfg` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'node-img 图片裁剪JSON配置',
  `direction` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'node-triangle 三角形的方向',
  `source` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'edge-边起始',
  `target` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'edge-边目标',
  `combo_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'combo-分组',
  `padding` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '30' COMMENT 'combo-JSON分组内边距',
  `parent_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'combo-父级分组',
  `children` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'combo-JSON分组内含元素',
  `style` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '元素样式-JONS配置',
  `label` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标签文本',
  `label_cfg` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标签文本-JSON配置',
  PRIMARY KEY (`row_id`),
  KEY `idx_group` (`row_group`) USING BTREE COMMENT '组'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT='图表-G6关系图数据';


-- 新增初始图
INSERT INTO `omc_db`.`chart_graph` (`row_id`, `row_type`, `row_group`, `id`, `type`, `depth`, `x`, `y`, `size`, `icon`, `img`, `clip_cfg`, `direction`, `source`, `target`, `combo_id`, `padding`, `parent_id`, `children`, `style`, `label`, `label_cfg`) VALUES (1, 'node', 'hello', 'node-1', 'rect', 0, -218, -20, '[80,40]', '{\"height\":25,\"img\":\"/svg/service.svg\",\"offset\":20,\"show\":false,\"width\":25}', '', '', '', '', '', '', '', '', '', '{\"active\":{\"fill\":\"rgb(247, 250, 255)\",\"lineWidth\":2,\"shadowBlur\":10,\"shadowColor\":\"rgb(95, 149, 255)\",\"stroke\":\"rgb(95, 149, 255)\"},\"cursor\":\"pointer\",\"disable\":{\"fill\":\"rgb(250, 250, 250)\",\"lineWidth\":1,\"stroke\":\"rgb(224, 224, 224)\"},\"fill\":\"#ff0000\",\"highlight\":{\"fill\":\"rgb(223, 234, 255)\",\"lineWidth\":2,\"stroke\":\"#4572d9\",\"text-shape\":{\"fontWeight\":500}},\"inactive\":{\"fill\":\"rgb(247, 250, 255)\",\"lineWidth\":1,\"stroke\":\"rgb(191, 213, 255)\"},\"lineWidth\":1,\"radius\":4,\"selected\":{\"fill\":\"rgb(255, 255, 255)\",\"lineWidth\":4,\"shadowBlur\":10,\"shadowColor\":\"rgb(95, 149, 255)\",\"stroke\":\"rgb(95, 149, 255)\",\"text-shape\":{\"fontWeight\":500}},\"stroke\":\"#ff0000\"}', 'Node-1', '{\"offset\":0,\"position\":\"center\",\"style\":{\"fill\":\"#ffffff\",\"fontSize\":12,\"fontWeight\":500}}');
INSERT INTO `omc_db`.`chart_graph` (`row_id`, `row_type`, `row_group`, `id`, `type`, `depth`, `x`, `y`, `size`, `icon`, `img`, `clip_cfg`, `direction`, `source`, `target`, `combo_id`, `padding`, `parent_id`, `children`, `style`, `label`, `label_cfg`) VALUES (2, 'node', 'hello', 'node-2', 'star', 0, 82, -15, '60', '{\"height\":25,\"img\":\"\",\"offset\":20,\"show\":false,\"width\":25}', '', '', '', '', '', '', '', '', '', '{\"active\":{\"fill\":\"rgb(247, 250, 255)\",\"lineWidth\":2,\"shadowBlur\":10,\"shadowColor\":\"rgb(95, 149, 255)\",\"stroke\":\"rgb(95, 149, 255)\"},\"cursor\":\"pointer\",\"disable\":{\"fill\":\"rgb(250, 250, 250)\",\"lineWidth\":1,\"stroke\":\"rgb(224, 224, 224)\"},\"fill\":\"#2bff00\",\"highlight\":{\"fill\":\"rgb(223, 234, 255)\",\"lineWidth\":2,\"stroke\":\"#4572d9\",\"text-shape\":{\"fontWeight\":500}},\"inactive\":{\"fill\":\"rgb(247, 250, 255)\",\"lineWidth\":1,\"stroke\":\"rgb(191, 213, 255)\"},\"lineWidth\":1,\"radius\":4,\"selected\":{\"fill\":\"rgb(255, 255, 255)\",\"lineWidth\":4,\"shadowBlur\":10,\"shadowColor\":\"rgb(95, 149, 255)\",\"stroke\":\"rgb(95, 149, 255)\",\"text-shape\":{\"fontWeight\":500}},\"stroke\":\"#05ff16\"}', 'Node-2', '{\"offset\":0,\"position\":\"center\",\"style\":{\"fill\":\"#ffffff\",\"fontSize\":12,\"fontWeight\":500}}');
INSERT INTO `omc_db`.`chart_graph` (`row_id`, `row_type`, `row_group`, `id`, `type`, `depth`, `x`, `y`, `size`, `icon`, `img`, `clip_cfg`, `direction`, `source`, `target`, `combo_id`, `padding`, `parent_id`, `children`, `style`, `label`, `label_cfg`) VALUES (3, 'edge', 'hello', 'node-1~1704427926706~node-2', 'polyline', 0, 0, 0, '', '', '', '', '', 'node-1', 'node-2', '', '', '', '', '{\"active\":{\"lineWidth\":1,\"stroke\":\"rgb(95, 149, 255)\"},\"cursor\":\"pointer\",\"disable\":{\"lineWidth\":1,\"stroke\":\"rgb(245, 245, 245)\"},\"endArrow\":true,\"highlight\":{\"lineWidth\":2,\"stroke\":\"rgb(95, 149, 255)\",\"text-shape\":{\"fontWeight\":500}},\"inactive\":{\"lineWidth\":1,\"stroke\":\"rgb(234, 234, 234)\"},\"lineWidth\":5,\"offset\":20,\"radius\":2,\"selected\":{\"lineWidth\":2,\"shadowBlur\":10,\"shadowColor\":\"rgb(95, 149, 255)\",\"stroke\":\"rgb(95, 149, 255)\",\"text-shape\":{\"fontWeight\":500}},\"stroke\":\"#0062ff\"}', '1 to 2', '{\"autoRotate\":false,\"position\":\"middle\",\"refX\":0,\"refY\":0,\"style\":{\"fill\":\"#ffffff\",\"fontSize\":12,\"fontWeight\":500}}');


SET FOREIGN_KEY_CHECKS=1;    