shikeying
2022-09-27 fb66d5ed24e716e536543364f746a9db5aeb20a9
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
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 以下为索引设置
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
ALTER TABLE rc_video_t1
    ADD INDEX inx_src_img (src_img) USING BTREE ;
 
ALTER TABLE rc_video_t1
    ADD INDEX inx_src_vid (src_video_id) USING BTREE ;
 
ALTER TABLE rc_video_t2
    ADD INDEX inx_t2_src_vid (src_video_id) USING BTREE ;
ALTER TABLE rc_video_t2
    ADD INDEX inx_t2_src_bid (batch_id) USING BTREE ;
 
-- ALTER TABLE rc_video_batch
--     ADD INDEX inx_vb_vid (src_video_id) USING BTREE ;
 
ALTER TABLE rc_video_batch
    ADD INDEX inx_vb_bid (batch_id) USING BTREE ;
 
ALTER TABLE rc_video_user
    ADD INDEX inx_vu_uid (user_id) USING BTREE ;
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 以下为表结构
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
create table milvus_video_batch (
                                    batch_id bigint(20) not null comment '批次id,即:日期时间',
                                    video_id varchar(255) not null,
                                    video_path varchar(255) default null,
                                    vector_size int(11) not null default '0',
                                    create_time bigint(20) not null,
                                    status int(11) not null default '1' comment '状态:0 未完成,1完成'
) engine=innodb default charset=utf8;
 
create table milvus_video_search (
                                     milvus_id text,
                                     image_path text,
                                     video_id text
) engine=innodb default charset=utf8;
 
create table milvus_video_status (
                                     id varchar(255) not null comment '视频路径',
                                     create_time bigint(20) not null,
                                     status int(11) not null default '0' comment '完成状态: 0 未完成, 1 完成',
                                     records bigint(20) not null default '0',
                                     primary key (id)
) engine=innodb default charset=utf8;
 
create table rc_task_status (
                                id bigint(20) not null comment '主键',
                                create_time bigint(20) not null comment '创建时间,如: 20220922180501',
                                name varchar(180) not null comment '任务名称',
                                last_value bigint(20) not null comment '获取数据的最大值',
                                status varchar(32) not null comment '当前状态,见枚举: taskstatus',
                                start_time bigint(20) default null,
                                end_time bigint(20) default null,
                                msg varchar(180) default null comment '执行描述',
                                task_type varchar(32) not null comment '任务类型,见枚举: tasktype',
                                primary key (id)
) engine=innodb default charset=utf8;
 
create table rc_video_batch (
                                id bigint(20) not null,
                                batch_id varchar(32) not null comment '批次id',
                                user_id bigint(20) not null,
                                src_video_id varchar(32) not null,
                                src_video_path varchar(255) default null,
                                primary key (id),
                                key inx_vb_bid (batch_id) using btree
) engine=innodb default charset=utf8;
 
create table rc_video_t1 (
                             src_img varchar(36) not null comment '图像id',
                             src_video_id varchar(32) not null,
                             sim_video_id varchar(32) not null,
                             distance double not null default '0',
                             id varchar(32) not null,
                             primary key (id),
                             key inx_src_img (src_img) using btree,
                             key inx_src_vid (src_video_id) using btree
) engine=innodb default charset=utf8;
 
create table rc_video_t2 (
                             src_video_id varchar(32) not null,
                             sim_video_id varchar(32) not null,
                             score double not null default '0' comment '相似视频综合得分',
                             id varchar(32) not null,
                             batch_id varchar(32) not null default '0',
                             primary key (id),
                             key inx_t2_src_vid (src_video_id) using btree,
                             key inx_t2_src_bid (batch_id) using btree
) engine=innodb default charset=utf8;
 
create table rc_video_user (
                               user_id bigint(20) not null,
                               video_id varchar(32) not null,
                               score double not null default '0',
                               create_time bigint(20) not null default '0',
                               id bigint(20) not null,
                               primary key (id),
                               key inx_vu_uid (user_id) using btree
) engine=innodb default charset=utf8;
 
create table s_host (
                        id bigint(20) not null auto_increment,
                        create_time bigint(20) not null,
                        create_user varchar(36) not null,
                        url varchar(200) not null comment '库地址',
                        port int(11) not null default '1306' comment '端口',
                        service_name varchar(100) default null comment '服务名称',
                        authentication varchar(30) default null comment '认证用户',
                        certification varchar(30) default null comment '授权密码',
                        max_active int(11) not null default '5' comment '最大连接数',
                        primary key (id)
) engine=innodb auto_increment=105 default charset=utf8 comment='存储资源可用主机';
 
create table s_scheduler (
                             id int(11) not null comment '调度器id',
                             create_time bigint(20) not null,
                             name varchar(180) not null,
                             status int(11) not null default '0' comment '状态:0_初始化,1_运行,2_暂停,9_结束,-1_人工终止',
                             start_time bigint(20) not null default '0' comment '调度开始运行时间',
                             end_time bigint(20) not null default '0' comment '调度结束运行时间',
                             interval_time int(11) not null default '5000' comment '内部线程执行间隔时间,默认:5秒',
                             sleep_time int(11) not null default '600000' comment '线程执行中,睡眠时间,默认:10分钟',
                             sleep_option int(11) not null default '1' comment '采集线程在没有获取数据时,是否进入休眠:0_否,1_是',
                             period_type varchar(36) not null comment '周期类型:none,day,week,month,year',
                             time_type varchar(36) not null comment '定时类型:精确时间_exactly,时间段_range',
                             year int(11) not null default '0',
                             month int(11) not null default '0',
                             day int(11) not null default '0',
                             hour int(11) not null default '0',
                             ranges varchar(50) default null comment '时间范围,多个如:5,6;12,15;...',
                             dept int(11) not null default '0',
                             class_name varchar(200) not null,
                             pause_time bigint(20) not null default '0',
                             summary varchar(255) default null,
                             primary key (id)
) engine=innodb default charset=utf8 comment='平台调度器记录表';
 
create table sdc_gather (
                            id bigint(20) not null,
                            create_time bigint(20) not null,
                            create_user varchar(36) not null,
                            name varchar(120) not null comment '采集名称',
                            description varchar(255) default null,
                            src_type tinyint(4) not null default '0' comment '采集源:0_http,1_db',
                            src_url varchar(120) not null,
                            src_port int(11) default '80',
                            src_service varchar(120) default null,
                            src_user varchar(120) default null,
                            src_pass varchar(120) default null,
                            store_id varchar(36) not null comment '外键:存储id',
                            status tinyint(4) not null default '0' comment '状态:0_初始化,1_运行,2_暂停,9_结束',
                            schedule_id int(11) not null comment '调度器id',
                            primary key (id)
) engine=innodb default charset=utf8 comment='采集任务记录';
 
create table sdc_meta_db (
                             id bigint(20) not null,
                             create_time bigint(20) not null,
                             store_id varchar(36) not null comment '外键:存储id',
                             database_name varchar(60) default null,
                             used tinyint(4) not null default '0' comment '是否被使用过:0_否,1_是',
                             is_using tinyint(4) not null default '0' comment '正在被使用:0_否,1_是',
                             host_info varchar(100) not null comment '存储使用库的信息:ip:port',
                             table_count int(11) not null default '0' comment '存在的表数量',
                             summary varchar(255) default null,
                             password varchar(255) default null,
                             username varchar(255) default null,
                             primary key (id),
                             key store_id (store_id),
                             constraint sdc_meta_db_ibfk_1 foreign key (store_id) references sdc_store (id) on delete cascade
) engine=innodb default charset=utf8 comment='元数据数据库信息';
 
create table sdc_meta_table (
                                id bigint(20) not null auto_increment,
                                create_time bigint(20) not null,
                                store_id varchar(36) not null comment '外键:存储id',
                                db_id bigint(20) not null comment '外键:dbid',
                                table_name varchar(60) not null comment '表名',
                                row_count bigint(20) not null default '0' comment '记录数量',
                                summary varchar(255) default null,
                                primary key (id),
                                key db_id (db_id),
                                key store_id (store_id),
                                constraint sdc_meta_table_ibfk_1 foreign key (db_id) references sdc_meta_db (id) on delete cascade,
                                constraint sdc_meta_table_ibfk_2 foreign key (store_id) references sdc_store (id) on delete cascade
) engine=innodb default charset=utf8 comment='元数据,表信息';
 
create table sdc_store (
                           id varchar(36) not null comment '存储id,主键',
                           create_time bigint(20) default null comment '创建时间毫秒值',
                           create_user varchar(36) not null,
                           description varchar(255) not null comment '描述',
                           inner_use tinyint(4) not null default '0' comment '内部使用:0_表示系统控制的内部数据,其他表示外部存储,如:自己手动加上的只作为记录',
                           type varchar(30) not null comment '存储类型:数据库、分布式文件系统等',
                           database_type tinyint(4) not null default '0' comment '数据库类型:0_derby,1_oracle,2_mysql,3_sqlserver',
                           strategy varchar(90) not null comment '存储策略的类名',
                           deleted tinyint(4) not null default '0' comment '是否废弃:1_是,0_否',
                           update_time bigint(20) default null comment '更新时间',
                           update_user varchar(36) default null comment '更新用户',
                           define_name varchar(60) not null comment '存储库定义名字,如:数据库名',
                           select_hosts varchar(100) not null comment '选择主机信息,多个用英文分号隔开',
                           primary key (id)
) engine=innodb default charset=utf8;