参考文章

依赖的表

需要依赖两张表,
interface_info和interface_release

interface_info

  1. CREATE TABLE `interface_info` (
  2. `api_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  3. `api_method` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'HttpMethod:GET、PUT、POST',
  4. `api_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '拦截路径',
  5. `api_status` int(2) NOT NULL COMMENT '状态:0草稿,1发布,2有变更,3禁用',
  6. `api_comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '注释',
  7. `api_type` varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '脚本类型:SQL、DataQL',
  8. `api_script` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '查询脚本:xxxxxxx',
  9. `api_schema` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口的请求/响应数据结构',
  10. `api_sample` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求/响应/请求头样本数据',
  11. `api_option` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '扩展配置信息',
  12. `api_create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  13. `api_gmt_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  14. PRIMARY KEY (`api_id`) USING BTREE
  15. ) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'Dataway 中的API' ROW_FORMAT = Dynamic;
  1. CREATE TABLE `interface_info` (
  2. `api_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  3. `api_method` varchar(12) NOT NULL COMMENT 'HttpMethod:GET、PUT、POST',
  4. `api_path` varchar(512) NOT NULL COMMENT '拦截路径',
  5. `api_status` int(2) NOT NULL COMMENT '状态:0草稿,1发布,2有变更,3禁用',
  6. `api_comment` varchar(255) NULL COMMENT '注释',
  7. `api_type` varchar(24) NOT NULL COMMENT '脚本类型:SQL、DataQL',
  8. `api_script` mediumtext NOT NULL COMMENT '查询脚本:xxxxxxx',
  9. `api_schema` mediumtext NULL COMMENT '接口的请求/响应数据结构',
  10. `api_sample` mediumtext NULL COMMENT '请求/响应/请求头样本数据',
  11. `api_create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  12. `api_gmt_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  13. PRIMARY KEY (`api_id`)
  14. ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='Dataway 中的API';

interface_release

  1. CREATE TABLE `interface_release` (
  2. `pub_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Publish ID',
  3. `pub_api_id` int(11) NOT NULL COMMENT '所属API ID',
  4. `pub_method` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'HttpMethod:GET、PUT、POST',
  5. `pub_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '拦截路径',
  6. `pub_status` int(2) NOT NULL COMMENT '状态:0有效,1无效(可能被下线)',
  7. `pub_type` varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '脚本类型:SQL、DataQL',
  8. `pub_script` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '查询脚本:xxxxxxx',
  9. `pub_script_ori` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '原始查询脚本,仅当类型为SQL时不同',
  10. `pub_schema` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口的请求/响应数据结构',
  11. `pub_sample` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求/响应/请求头样本数据',
  12. `pub_option` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '扩展配置信息',
  13. `pub_release_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '发布时间(下线不更新)',
  14. PRIMARY KEY (`pub_id`) USING BTREE,
  15. INDEX `idx_interface_release`(`pub_api_id`) USING BTREE
  16. ) ENGINE = InnoDB AUTO_INCREMENT = 644 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'Dataway API 发布记录' ROW_FORMAT = Dynamic;
  1. CREATE TABLE `interface_release` (
  2. `pub_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Publish ID',
  3. `pub_api_id` int(11) NOT NULL COMMENT '所属API ID',
  4. `pub_method` varchar(12) NOT NULL COMMENT 'HttpMethod:GET、PUT、POST',
  5. `pub_path` varchar(512) NOT NULL COMMENT '拦截路径',
  6. `pub_status` int(2) NOT NULL COMMENT '状态:0有效,1无效(可能被下线)',
  7. `pub_type` varchar(24) NOT NULL COMMENT '脚本类型:SQL、DataQL',
  8. `pub_script` mediumtext NOT NULL COMMENT '查询脚本:xxxxxxx',
  9. `pub_script_ori` mediumtext NOT NULL COMMENT '原始查询脚本,仅当类型为SQL时不同',
  10. `pub_schema` mediumtext NULL COMMENT '接口的请求/响应数据结构',
  11. `pub_sample` mediumtext NULL COMMENT '请求/响应/请求头样本数据',
  12. `pub_release_time`datetime DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间(下线不更新)',
  13. PRIMARY KEY (`pub_id`)
  14. ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='Dataway API 发布历史。';
  15. create index idx_interface_release on interface_release (pub_api_id);