-
Notifications
You must be signed in to change notification settings - Fork 3
/
dag.sql
142 lines (135 loc) · 7.22 KB
/
dag.sql
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
CREATE TABLE `edge`
(
`edge_id` int unsigned NOT NULL AUTO_INCREMENT,
`start_vertex` int NOT NULL DEFAULT '0',
`end_vertex` int DEFAULT '0',
PRIMARY KEY (`edge_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 34
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `task`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`workflow_id` int unsigned NOT NULL DEFAULT '0',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'open',
`result` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`parents` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `vertex_edge`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`workflow_id` int unsigned NOT NULL DEFAULT '0',
`task_id` int unsigned DEFAULT '0',
`pid` int unsigned DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 5
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE `workflow`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`is_active` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '0 否 1 是',
`status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for application
-- ----------------------------
DROP TABLE IF EXISTS `application`;
CREATE TABLE `application`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否审核 0:否 1:是',
`app_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '应用名称',
`app_key` char(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'APP KEY',
`secret_key` char(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'SECRET KEY',
`step` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '重试间隔(秒)',
`retry_total` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '重试次数',
`link_url` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '接口地址',
`remark` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '备注信息',
`created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `unq_app_key` (`app_key`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 43
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT ='工作任务';
-- ----------------------------
-- Table structure for task
-- ----------------------------
DROP TABLE IF EXISTS `task`;
CREATE TABLE `task`
(
`id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
`is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '任务状态 0:待处理 1:处理中 2:已处理 3:已取消',
`app_key` char(32) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'APP KEY',
`task_no` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '任务编号',
`step` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '重试间隔(秒)',
`runtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '执行时间',
`content` longtext CHARACTER SET utf8 NOT NULL COMMENT '任务内容',
`created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_task_no` (`app_key`, `task_no`),
KEY `idx_is_deleted` (`is_deleted`, `status`, `runtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT ='任务列表';
-- ----------------------------
-- Table structure for task_abort
-- ----------------------------
DROP TABLE IF EXISTS `task_abort`;
CREATE TABLE `task_abort`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`task_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '任务ID',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '拦截状态 0:未知 1:拦截成功',
`created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_task_id` (`task_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT ='拦截记录';
-- ----------------------------
-- Table structure for task_log
-- ----------------------------
DROP TABLE IF EXISTS `task_log`;
CREATE TABLE `task_log`
(
`id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
`is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`task_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '任务ID',
`retry` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '重试次数',
`remark` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '备注信息',
`created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_task_id` (`task_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT ='系统日志';
SET FOREIGN_KEY_CHECKS = 1;