/*
 Navicat Premium Dump SQL

 Source Server         : 华为云-mysql数据库
 Source Server Type    : MySQL
 Source Server Version : 80403 (8.4.3)
 Source Host           : 121.37.111.42:3306
 Source Schema         : dataease

 Target Server Type    : MySQL
 Target Server Version : 80403 (8.4.3)
 File Encoding         : 65001

 Date: 30/05/2025 14:22:13
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for core_dataset_group
-- ----------------------------
DROP TABLE IF EXISTS `core_dataset_group`;
CREATE TABLE `core_dataset_group`  (
  `id` bigint NOT NULL COMMENT 'ID',
  `app_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用ID 关联应用系统',
  `name` varchar(128) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '名称',
  `pid` bigint NULL DEFAULT NULL COMMENT '父级ID',
  `level` int NULL DEFAULT 0 COMMENT '当前分组处于第几级',
  `node_type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT 'node类型：folder or dataset',
  `type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'sql,union',
  `mode` int NULL DEFAULT 0 COMMENT '连接模式：0-直连，1-同步(包括excel、api等数据存在de中的表)',
  `info` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '关联关系树',
  `create_by` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '创建人ID',
  `create_time` bigint NULL DEFAULT NULL COMMENT '创建时间',
  `qrtz_instance` varchar(1024) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'Quartz 实例 ID',
  `sync_status` varchar(45) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '同步状态',
  `update_by` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '更新人ID',
  `last_update_time` bigint NULL DEFAULT 0 COMMENT '最后同步时间',
  `union_sql` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '关联sql',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '数据集分组表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_dataset_table
-- ----------------------------
DROP TABLE IF EXISTS `core_dataset_table`;
CREATE TABLE `core_dataset_table`  (
  `id` bigint NOT NULL COMMENT 'ID',
  `app_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用ID 关联应用系统',
  `name` varchar(128) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '名称',
  `table_name` varchar(128) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '物理表名',
  `datasource_id` bigint NULL DEFAULT NULL COMMENT '数据源ID',
  `dataset_group_id` bigint NOT NULL COMMENT '数据集ID',
  `type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'db,sql,union,excel,api',
  `info` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '表原始信息,表名,sql等',
  `sql_variable_details` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT 'SQL参数',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = 'table数据集' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_dataset_table_field
-- ----------------------------
DROP TABLE IF EXISTS `core_dataset_table_field`;
CREATE TABLE `core_dataset_table_field`  (
  `id` bigint NOT NULL COMMENT 'ID',
  `datasource_id` bigint NULL DEFAULT NULL COMMENT '数据源ID',
  `dataset_table_id` bigint NULL DEFAULT NULL COMMENT '数据表ID',
  `dataset_group_id` bigint NULL DEFAULT NULL COMMENT '数据集ID',
  `chart_id` bigint NULL DEFAULT NULL COMMENT '图表ID',
  `origin_name` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '原始字段名',
  `name` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '字段名用于展示',
  `description` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '描述',
  `dataease_name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'de字段名用作唯一标识',
  `field_short_name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'de字段别名',
  `group_list` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '分组设置',
  `other_group` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '未分组的值',
  `group_type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '维度/指标标识 d:维度，q:指标',
  `type` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '原始字段类型',
  `size` int NULL DEFAULT NULL COMMENT '字段长度（允许为空，默认0）',
  `de_type` int NOT NULL COMMENT 'dataease字段类型：0-文本，1-时间，2-整型数值，3-浮点数值，4-布尔，5-地理位置，6-二进制，7-URL',
  `de_extract_type` int NOT NULL COMMENT 'de记录的原始类型',
  `ext_field` int NULL DEFAULT NULL COMMENT '是否扩展字段 0原始 1复制 2计算字段...',
  `checked` tinyint(1) NULL DEFAULT 1 COMMENT '是否选中',
  `column_index` int NULL DEFAULT NULL COMMENT '列位置',
  `last_sync_time` bigint NULL DEFAULT NULL COMMENT '同步时间',
  `accuracy` int NULL DEFAULT 0 COMMENT '精度',
  `date_format` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '时间字段类型',
  `date_format_type` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '时间格式类型',
  `params` text CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '计算字段参数',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = 'table数据集表字段' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_dataset_table_sql_log
-- ----------------------------
DROP TABLE IF EXISTS `core_dataset_table_sql_log`;
CREATE TABLE `core_dataset_table_sql_log`  (
  `id` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL DEFAULT '' COMMENT 'ID',
  `table_id` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL DEFAULT '' COMMENT '数据集SQL节点ID',
  `start_time` bigint NULL DEFAULT NULL COMMENT '开始时间',
  `end_time` bigint NULL DEFAULT NULL COMMENT '结束时间',
  `spend` bigint NULL DEFAULT NULL COMMENT '耗时(毫秒)',
  `sql` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '详细信息',
  `status` varchar(45) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = 'table数据集查询sql日志' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_datasource
-- ----------------------------
DROP TABLE IF EXISTS `core_datasource`;
CREATE TABLE `core_datasource`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `app_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用ID 关联应用系统',
  `name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '名称',
  `description` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '描述',
  `type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '类型',
  `pid` bigint NULL DEFAULT NULL COMMENT '父级ID',
  `edit_type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '更新方式：0：替换；1：追加',
  `configuration` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '详细信息',
  `create_time` bigint NOT NULL COMMENT '创建时间',
  `update_time` bigint NOT NULL COMMENT '更新时间',
  `update_by` bigint NULL DEFAULT NULL COMMENT '变更人',
  `create_by` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '创建人ID',
  `status` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '状态',
  `qrtz_instance` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '状态',
  `task_status` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '任务状态',
  `enable_data_fill` tinyint NULL DEFAULT 0 COMMENT '启用数据填报功能',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1915350839984336899 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '数据源表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_datasource_task
-- ----------------------------
DROP TABLE IF EXISTS `core_datasource_task`;
CREATE TABLE `core_datasource_task`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `ds_id` bigint NOT NULL COMMENT '数据源ID',
  `name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '任务名称',
  `update_type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '更新方式',
  `start_time` bigint NULL DEFAULT NULL COMMENT '开始时间',
  `sync_rate` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '执行频率：0 一次性 1 cron',
  `cron` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT 'cron表达式',
  `simple_cron_value` bigint NULL DEFAULT NULL COMMENT '简单重复间隔',
  `simple_cron_type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '简单重复类型：分、时、天',
  `end_limit` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '结束限制 0 无限制 1 设定结束时间',
  `end_time` bigint NULL DEFAULT NULL COMMENT '结束时间',
  `create_time` bigint NULL DEFAULT NULL COMMENT '创建时间',
  `last_exec_time` bigint NULL DEFAULT NULL COMMENT '上次执行时间',
  `last_exec_status` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '上次执行结果',
  `extra_data` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '额外数据',
  `task_status` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '任务状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '数据源定时同步任务' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_datasource_task_log
-- ----------------------------
DROP TABLE IF EXISTS `core_datasource_task_log`;
CREATE TABLE `core_datasource_task_log`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `ds_id` bigint NOT NULL COMMENT '数据源ID',
  `task_id` bigint NULL DEFAULT NULL COMMENT '任务ID',
  `start_time` bigint NULL DEFAULT NULL COMMENT '开始时间',
  `end_time` bigint NULL DEFAULT NULL COMMENT '结束时间',
  `task_status` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '执行状态',
  `table_name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '表名',
  `info` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '错误信息',
  `create_time` bigint NULL DEFAULT NULL COMMENT '创建时间',
  `trigger_type` varchar(45) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '更新频率类型',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_dataset_table_task_log_ds_id`(`ds_id` ASC) USING BTREE,
  INDEX `idx_dataset_table_task_log_task_id`(`task_id` ASC) USING BTREE,
  INDEX `idx_dataset_table_task_log_A`(`ds_id` ASC, `table_name` ASC, `start_time` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1125460897473630209 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '数据源定时同步任务执行日志' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_de_engine
-- ----------------------------
DROP TABLE IF EXISTS `core_de_engine`;
CREATE TABLE `core_de_engine`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '名称',
  `description` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '描述',
  `type` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '类型',
  `configuration` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '详细信息',
  `create_time` bigint NULL DEFAULT NULL COMMENT 'Create timestamp',
  `update_time` bigint NULL DEFAULT NULL COMMENT 'Update timestamp',
  `create_by` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '创建人ID',
  `status` varchar(45) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '数据引擎' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_driver
-- ----------------------------
DROP TABLE IF EXISTS `core_driver`;
CREATE TABLE `core_driver`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '名称',
  `create_time` bigint NOT NULL COMMENT '创建时间',
  `type` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '数据源类型',
  `driver_class` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '驱动类',
  `description` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '驱动' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for core_driver_jar
-- ----------------------------
DROP TABLE IF EXISTS `core_driver_jar`;
CREATE TABLE `core_driver_jar`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `de_driver_id` varchar(50) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL COMMENT '驱动主键',
  `file_name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '名称',
  `version` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '版本',
  `driver_class` longtext CHARACTER SET utf16 COLLATE utf16_general_ci NULL COMMENT '驱动类',
  `trans_name` varchar(255) CHARACTER SET utf16 COLLATE utf16_general_ci NULL DEFAULT NULL COMMENT '替换后的 jar 包名称',
  `is_trans_name` tinyint(1) NULL DEFAULT NULL COMMENT '是否将上传 jar 包替换了名称（1-是，0-否）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf16 COLLATE = utf16_general_ci COMMENT = '驱动详情' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
