-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinit.sql
295 lines (265 loc) · 11.6 KB
/
init.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
create table ems.ems_dead_msg
(
id bigint auto_increment,
topic_name varchar(255) not null,
group_name varchar(255) not null,
offset bigint not null,
consumer_times int default 1 not null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
primary key (id, topic_name, group_name)
);
create table ems.ems_group_client_table
(
id bigint auto_increment,
group_name varchar(255) not null,
client_id varchar(255) not null,
renew_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
state int not null,
last_offset bigint null,
last_consumer_time datetime default CURRENT_TIMESTAMP null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
primary key (id, group_name)
);
create table ems.ems_qrtz_calendars
(
SCHED_NAME varchar(120) not null,
CALENDAR_NAME varchar(200) not null,
CALENDAR blob not null,
primary key (SCHED_NAME, CALENDAR_NAME)
);
create table ems.ems_qrtz_fired_triggers
(
SCHED_NAME varchar(120) not null,
ENTRY_ID varchar(95) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
INSTANCE_NAME varchar(200) not null,
FIRED_TIME bigint not null,
SCHED_TIME bigint not null,
PRIORITY int not null,
STATE varchar(16) not null,
JOB_NAME varchar(200) null,
JOB_GROUP varchar(200) null,
IS_NONCONCURRENT varchar(1) null,
REQUESTS_RECOVERY varchar(1) null,
primary key (SCHED_NAME, ENTRY_ID)
);
create table ems.ems_qrtz_job_details
(
SCHED_NAME varchar(120) not null,
JOB_NAME varchar(200) not null,
JOB_GROUP varchar(200) not null,
DESCRIPTION varchar(250) null,
JOB_CLASS_NAME varchar(250) not null,
IS_DURABLE varchar(1) not null,
IS_NONCONCURRENT varchar(1) not null,
IS_UPDATE_DATA varchar(1) not null,
REQUESTS_RECOVERY varchar(1) not null,
JOB_DATA blob null,
primary key (SCHED_NAME, JOB_NAME, JOB_GROUP)
);
create table ems.ems_qrtz_locks
(
SCHED_NAME varchar(120) not null,
LOCK_NAME varchar(40) not null,
primary key (SCHED_NAME, LOCK_NAME)
);
create table ems.ems_qrtz_paused_trigger_grps
(
SCHED_NAME varchar(120) not null,
TRIGGER_GROUP varchar(200) not null,
primary key (SCHED_NAME, TRIGGER_GROUP)
);
create table ems.ems_qrtz_scheduler_state
(
SCHED_NAME varchar(120) not null,
INSTANCE_NAME varchar(200) not null,
LAST_CHECKIN_TIME bigint not null,
CHECKIN_INTERVAL bigint not null,
primary key (SCHED_NAME, INSTANCE_NAME)
);
create table ems.ems_qrtz_triggers
(
SCHED_NAME varchar(120) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
JOB_NAME varchar(200) not null,
JOB_GROUP varchar(200) not null,
DESCRIPTION varchar(250) null,
NEXT_FIRE_TIME bigint null,
PREV_FIRE_TIME bigint null,
PRIORITY int null,
TRIGGER_STATE varchar(16) not null,
TRIGGER_TYPE varchar(8) not null,
START_TIME bigint not null,
END_TIME bigint null,
CALENDAR_NAME varchar(200) null,
MISFIRE_INSTR smallint null,
JOB_DATA blob null,
primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
constraint EMS_QRTZ_TRIGGERS_ibfk_1
foreign key (SCHED_NAME, JOB_NAME, JOB_GROUP) references ems.ems_qrtz_job_details (SCHED_NAME, JOB_NAME, JOB_GROUP)
);
create table ems.ems_qrtz_blob_triggers
(
SCHED_NAME varchar(120) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
BLOB_DATA blob null,
primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
constraint EMS_QRTZ_BLOB_TRIGGERS_ibfk_1
foreign key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) references ems.ems_qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);
create table ems.ems_qrtz_cron_triggers
(
SCHED_NAME varchar(120) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
CRON_EXPRESSION varchar(200) not null,
TIME_ZONE_ID varchar(80) null,
primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
constraint EMS_QRTZ_CRON_TRIGGERS_ibfk_1
foreign key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) references ems.ems_qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);
create table ems.ems_qrtz_simple_triggers
(
SCHED_NAME varchar(120) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
REPEAT_COUNT bigint not null,
REPEAT_INTERVAL bigint not null,
TIMES_TRIGGERED bigint not null,
primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
constraint EMS_QRTZ_SIMPLE_TRIGGERS_ibfk_1
foreign key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) references ems.ems_qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);
create table ems.ems_qrtz_simprop_triggers
(
SCHED_NAME varchar(120) not null,
TRIGGER_NAME varchar(200) not null,
TRIGGER_GROUP varchar(200) not null,
STR_PROP_1 varchar(512) null,
STR_PROP_2 varchar(512) null,
STR_PROP_3 varchar(512) null,
INT_PROP_1 int null,
INT_PROP_2 int null,
LONG_PROP_1 bigint null,
LONG_PROP_2 bigint null,
DEC_PROP_1 decimal(13, 4) null,
DEC_PROP_2 decimal(13, 4) null,
BOOL_PROP_1 varchar(1) null,
BOOL_PROP_2 varchar(1) null,
primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
constraint EMS_QRTZ_SIMPROP_TRIGGERS_ibfk_1
foreign key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) references ems.ems_qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);
create index SCHED_NAME
on ems.ems_qrtz_triggers (SCHED_NAME, JOB_NAME, JOB_GROUP);
create table ems.ems_retry_msg
(
id bigint auto_increment
primary key,
old_topic_name varchar(255) not null,
retry_topic_name varchar(255) null,
group_name varchar(255) not null,
offset bigint not null,
consumer_times int default 1 not null,
next_consumer_time datetime default CURRENT_TIMESTAMP not null,
client_id varchar(255) not null,
state int default 1 not null comment '1. 重试中, 2. 重试成功;',
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null
);
create index ems_retry_msg_client_id_index
on ems.ems_retry_msg (client_id);
create index ems_retry_msg_consumer_times_index
on ems.ems_retry_msg (consumer_times);
create index ems_retry_msg_group_name_index
on ems.ems_retry_msg (group_name);
create index ems_retry_msg_next_consumer_time_index
on ems.ems_retry_msg (next_consumer_time);
create index ems_retry_msg_retry_topic_name_index
on ems.ems_retry_msg (retry_topic_name);
create table ems.ems_simple_group
(
id bigint auto_increment,
topic_name varchar(255) not null,
group_type varchar(255) default 'CLUSTER' null,
group_name varchar(255) not null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
last_offset varchar(254) null,
primary key (id, topic_name, group_name),
constraint u_id
unique (topic_name, group_name)
);
create table ems.ems_simple_msg
(
id bigint auto_increment,
topic_name varchar(255) not null,
physics_offset bigint not null,
json_body text null,
from_ip varchar(255) not null,
properties text null,
tags varchar(255) null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
primary key (id, topic_name, physics_offset),
constraint simple_msg_pk
unique (topic_name, physics_offset)
);
create index create_time_index
on ems.ems_simple_msg (create_time);
create table ems.ems_simple_stream_system_config
(
id bigint auto_increment,
simple_key varchar(255) not null,
simple_value varchar(255) not null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
primary key (id, simple_key)
);
create table ems.ems_simple_topic
(
id bigint auto_increment,
topic_name varchar(255) not null,
rule int default 1 not null comment '1 可读可写,2 写,3 读,4 禁止读写',
type int default 1 not null,
last_offset varchar(254) null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null,
primary key (id, topic_name),
constraint simple_topic_pk
unique (topic_name)
);
create table ems.ems_topic_group_log
(
id bigint auto_increment
primary key,
topic_name varchar(255) not null,
physics_offset bigint not null,
group_name varchar(255) not null,
client_id varchar(255) not null,
state int null,
error_msg text null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted tinyint default 0 not null
);
create index topic_group_log__index_client_id
on ems.ems_topic_group_log (client_id);
create index topic_group_log__index_group_name
on ems.ems_topic_group_log (group_name);
create index topic_group_log__index_topic_name
on ems.ems_topic_group_log (topic_name);
create index topic_group_log_id_index_physics_offset
on ems.ems_topic_group_log (physics_offset);