-
Notifications
You must be signed in to change notification settings - Fork 5
/
data.sql
145 lines (124 loc) · 6.63 KB
/
data.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
143
144
-- auto-generated definition
create table application
(
id int unsigned auto_increment comment '自增ID'
primary key,
is_deleted tinyint unsigned default '0' not null comment '是否删除',
status tinyint unsigned default '0' not null comment '是否审核 0:否 1:是',
app_name varchar(100) default '' not null comment '应用名称',
app_key char(16) default '' not null comment 'APP KEY',
secret_key char(32) default '' not null comment 'SECRET KEY',
step tinyint unsigned default '0' not null comment '重试间隔(秒)',
retry_total tinyint unsigned default '0' not null comment '重试次数',
link_url varchar(200) default '' not null comment '接口地址',
remark varchar(255) default '' not null comment '备注信息',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp default CURRENT_TIMESTAMP not null comment '更新时间',
constraint unq_app_key
unique (app_key)
)
comment '工作任务' collate = utf8mb4_unicode_ci;
create table edge
(
edge_id int unsigned auto_increment
primary key,
start_vertex int default 0 not null,
end_vertex int default 0 null
);
create table failed_jobs
(
id bigint unsigned auto_increment
primary key,
uuid varchar(255) not null,
connection text not null,
queue text not null,
payload longtext not null,
exception longtext not null,
failed_at timestamp default CURRENT_TIMESTAMP not null,
constraint failed_jobs_uuid_unique
unique (uuid)
)
collate = utf8mb4_unicode_ci;
-- auto-generated definition
create table task
(
id bigint unsigned auto_increment comment '主键ID'
primary key,
is_deleted tinyint unsigned default '0' not null comment '是否删除',
status tinyint unsigned default '0' not null comment '任务状态 0:待处理 1:处理中 2:已处理 3:已取消 4:处理失败',
app_key char(32) charset utf8 default '' not null comment 'APP KEY',
task_no varchar(50) charset utf8 default '' not null comment '任务编号',
step tinyint unsigned default '0' not null comment '重试间隔(秒)',
runtime timestamp default CURRENT_TIMESTAMP not null comment '执行时间',
content longtext charset utf8 not null comment '任务内容',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
timeout int default -1 not null comment '任务执行时间',
name varchar(64) default '' not null comment '任务名称',
coroutine_id bigint default 0 not null comment '执行当前的任务协程ID,用于取消当前任务',
memo longtext null comment '当任务执行出现错误时,记录错误信息',
result longtext null comment '执行任务完成的结果',
retry_times int default 0 not null comment '重试次数',
consul_service_id varchar(64) default '' not null comment 'consul运行服务的ID',
constraint unq_task_no
unique (task_no)
)
comment '任务列表';
create index idx_create_at
on task (created_at);
create index idx_is_deleted
on task (is_deleted, status, runtime);
create index idx_task_no
on task (app_key, task_no);
;
create table task_abort
(
id int unsigned auto_increment comment ' 自增ID'
primary key,
is_deleted tinyint unsigned default '0' not null comment ' 是否删除 ',
task_id bigint unsigned default '0' not null comment ' 任务ID ',
status tinyint unsigned default '0' not null comment '拦截状态 0:未知 1:拦截成功 ',
created_at timestamp default CURRENT_TIMESTAMP not null comment ' 创建时间 ',
updated_at timestamp default CURRENT_TIMESTAMP not null comment ' 更新时间 '
)
comment '拦截记录' collate = utf8mb4_unicode_ci;
create index idx_task_id
on task_abort (task_id);
create index idx_task_id
on task_abort (task_id);
-- auto-generated definition
create table task_log
(
id bigint unsigned not null comment '主键ID'
primary key,
is_deleted tinyint unsigned default '0' not null comment '是否删除',
task_id bigint unsigned default '0' not null comment '任务ID',
retry tinyint unsigned default '0' not null comment '重试次数',
remark varchar(255) charset utf8 default '' not null comment '备注信息',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp default CURRENT_TIMESTAMP not null comment '更新时间'
)
comment '系统日志' collate = utf8mb4_unicode_ci;
create index idx_task_id
on task_log (task_id);
;
create table vertex_edge
(
id int unsigned auto_increment
primary key,
workflow_id int unsigned default '0' not null,
task_id int unsigned default '0' null,
pid int unsigned default '0' null
);
-- auto-generated definition
create table workflow
(
id int unsigned auto_increment
primary key,
name varchar(64) default '' not null,
is_active tinyint unsigned default '0' not null comment '0 否 1 是',
status varchar(32) default '' not null comment '任务状态 0:待处理 1:处理中 2:已处理 3:已取消 4:处理失败'',',
created_at timestamp default CURRENT_TIMESTAMP null,
updated_at timestamp default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP
)
comment '任务流工作表';