gateway-1.0.0.sql
3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CREATE TABLE `xtrade_gateway`.`t_route`
(
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`service_id` varchar(20) NOT NULL COMMENT '服务id名称',
`url` varchar(100) NOT NULL COMMENT '目标url',
`description` varchar(100) NOT NULL DEFAULT 1 COMMENT '描述字段',
`created_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modified_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`is_del` smallint(1) NOT NULL DEFAULT 1 COMMENT '1:删除 0:正常',
PRIMARY KEY (`id`)
) COMMENT = '路由表';
ALTER TABLE `xtrade_gateway`.`t_route`
ADD UNIQUE INDEX `uni_service_id` (`service_id`) USING BTREE COMMENT 'service_id唯一索引';
CREATE TABLE `xtrade_gateway`.`t_attr_config`
(
`id` bigint(0) NOT NULL COMMENT '主键',
`service_id` varchar(20) NOT NULL COMMENT '关联的服务id名称',
`type` smallint(1) NOT NULL COMMENT '1:predicate 2:filter 详见枚举GatewayAttrType',
`attr_name` varchar(20) NOT NULL COMMENT 'predicate或者filter的名称',
`attr_args` varchar(100) NULL COMMENT 'predicate或者filter的所属参数,json格式',
`description` varchar(100) NULL COMMENT '描述字段',
`sort_order` smallint(2) NOT NULL DEFAULT 0 COMMENT '排序字段',
`created_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modified_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`is_del` smallint(1) NOT NULL DEFAULT 1 COMMENT '1:删除 0:正常',
PRIMARY KEY (`id`)
) COMMENT = 'predicate和filter的配置表';
ALTER TABLE `xtrade_gateway`.`t_attr_config`
MODIFY COLUMN `order` smallint(2) NOT NULL DEFAULT 0 COMMENT '排序字段' AFTER `desc`;
ALTER TABLE `xtrade_gateway`.`t_attr_config`
ADD UNIQUE INDEX `uni_service_id&attr_name` (`service_id`, `attr_name`) USING BTREE COMMENT 'service_id和attr_name唯一约束';
CREATE TABLE `t_api_metrics`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`code` int(10) NOT NULL COMMENT 'response code',
`message` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'response提示消息',
`service_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '服务id',
`url` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '目标url',
`request_header` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求头json',
`request_body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求体',
`stack_trace` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '异常栈跟踪信息json',
`execute_time` bigint(10) NOT NULL COMMENT 'api执行时间,单位:ms',
`created_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = 'api请求指标记录表'
ROW_FORMAT = Compact;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `xtrade_gateway`.`t_api_metrics`
ADD COLUMN client_ip` varchar(40) NULL COMMENT '客户端ip' AFTER `url`;