大量更新
This commit is contained in:
173
999-数据库脚本/飞行服务/2.1/cmii_fly_center.sql
Normal file
173
999-数据库脚本/飞行服务/2.1/cmii_fly_center.sql
Normal file
@@ -0,0 +1,173 @@
|
||||
CREATE DATABASE IF NOT EXISTS `cmii_fly_center` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
use `cmii_fly_center`;
|
||||
|
||||
DROP TABLE IF EXISTS command_log;
|
||||
|
||||
DROP TABLE IF EXISTS drone_info;
|
||||
|
||||
DROP TABLE IF EXISTS file_records;
|
||||
|
||||
DROP TABLE IF EXISTS gateway_bound_info;
|
||||
|
||||
DROP TABLE IF EXISTS gateway_info;
|
||||
|
||||
DROP TABLE IF EXISTS storage_files;
|
||||
|
||||
DROP TABLE IF EXISTS track_order;
|
||||
|
||||
DROP TABLE IF EXISTS wayline_info;
|
||||
|
||||
DROP TABLE IF EXISTS wayline_info_history;
|
||||
|
||||
create table command_log
|
||||
(
|
||||
id bigint auto_increment comment '主键'
|
||||
primary key,
|
||||
drone_sn varchar(150) null comment '无人机 sn',
|
||||
gateway_sn varchar(150) null comment '网关序列号',
|
||||
gateway_type varchar(150) null comment '网关类型',
|
||||
cmd_id varchar(150) null comment '指令id',
|
||||
cmd_type varchar(150) not null comment '指令类型',
|
||||
cmd_params varchar(255) null comment '指令参数',
|
||||
response_data varchar(255) null comment '指令响应数据',
|
||||
error_msg varchar(255) null comment '指令错误信息',
|
||||
status int not null comment '指令状态',
|
||||
start_time datetime default now() null comment '指令开始时间',
|
||||
end_time datetime default now() null comment '指令结束时间',
|
||||
cost_time bigint null comment '指令耗时,单位 ms',
|
||||
trace_id varchar(255) null comment '追踪id'
|
||||
)
|
||||
comment '无人机指令日志';
|
||||
|
||||
create index command_log_cmd_type_index
|
||||
on command_log (cmd_type);
|
||||
|
||||
create index command_log_drone_sn_index
|
||||
on command_log (drone_sn);
|
||||
|
||||
create table drone_info
|
||||
(
|
||||
id bigint auto_increment comment '主键'
|
||||
primary key,
|
||||
sn varchar(150) not null comment '设备 SN',
|
||||
name varchar(100) null comment '无人机名称',
|
||||
manufacturer varchar(100) not null comment '厂家',
|
||||
model varchar(100) not null comment '型号,如果有子型号,拼接保存',
|
||||
version varchar(100) null comment '固件版本',
|
||||
offline_position varchar(255) null comment '无人机下线的时候最后的点位信息,json结构数据',
|
||||
constraint drone_info_pk_2
|
||||
unique (sn)
|
||||
)
|
||||
comment '设备信息';
|
||||
|
||||
create table file_records
|
||||
(
|
||||
id bigint auto_increment comment '主键'
|
||||
primary key,
|
||||
file_id varchar(255) not null comment '文件ID',
|
||||
file_name varchar(255) null comment '文件名称',
|
||||
content_type varchar(255) null comment '文件类型',
|
||||
signature varchar(255) null comment '文件签名',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
file_size bigint null comment '文件大小',
|
||||
constraint uniq_file_records_file_id
|
||||
unique (file_id)
|
||||
)
|
||||
comment '文件记录';
|
||||
|
||||
create table gateway_bound_info
|
||||
(
|
||||
id bigint auto_increment comment '主键'
|
||||
primary key,
|
||||
gateway_sn varchar(150) not null comment '网关 sn',
|
||||
drone_sn varchar(150) not null comment '无人机 sn',
|
||||
constraint uniq_gateway_bound_info_pk
|
||||
unique (drone_sn, gateway_sn)
|
||||
)
|
||||
comment '无人机设备绑定关系';
|
||||
|
||||
create index gateway_bound_info_gateway_sn_index
|
||||
on gateway_bound_info (gateway_sn);
|
||||
|
||||
create table gateway_info
|
||||
(
|
||||
id bigint auto_increment comment '主键'
|
||||
primary key,
|
||||
sn varchar(150) not null comment '网关 sn',
|
||||
type varchar(30) not null comment '类型',
|
||||
form int null comment '形态',
|
||||
model varchar(50) null comment '型号',
|
||||
name varchar(100) null comment '网关名称',
|
||||
version varchar(20) null comment '版本',
|
||||
stream_url varchar(255) null comment '推流地址[list]',
|
||||
constraint gateway_info_pk_2
|
||||
unique (sn)
|
||||
)
|
||||
comment '网关设备信息';
|
||||
|
||||
create table storage_files
|
||||
(
|
||||
id bigint auto_increment comment '文件ID'
|
||||
primary key,
|
||||
file_id char(36) not null comment '文件唯一标识',
|
||||
bucket varchar(64) not null comment 'OSS存储桶',
|
||||
object_path varchar(500) not null comment 'OSS对象路径',
|
||||
drone_sn char(32) null comment '无人机序列号',
|
||||
name varchar(255) not null comment '文件名称',
|
||||
type varchar(20) null comment '文件类型',
|
||||
size bigint unsigned default '0' null comment '文件大小(字节)',
|
||||
md5 char(32) null comment 'MD5哈希值',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
extra text null comment '额外信息',
|
||||
constraint uk_file_id
|
||||
unique (file_id)
|
||||
)
|
||||
comment '文件存储表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
create index idx_drone_sn
|
||||
on storage_files (drone_sn);
|
||||
|
||||
create index idx_object_path
|
||||
on storage_files (object_path(191));
|
||||
|
||||
create table track_order
|
||||
(
|
||||
track_id varchar(255) not null comment '轨迹id'
|
||||
primary key,
|
||||
drone_sn varchar(255) not null comment '无人机id',
|
||||
gateway_sn varchar(255) not null comment '网关序列号',
|
||||
first_track_time datetime not null comment '轨迹开始时间',
|
||||
last_track_time datetime not null comment '轨迹结束时间',
|
||||
distance bigint not null comment '轨迹距离,单位 m',
|
||||
duration bigint not null comment '轨迹中时长,单位 s',
|
||||
first_latitude double not null comment '轨迹开始纬度',
|
||||
first_longitude double not null comment '轨迹开始经度',
|
||||
last_latitude double not null comment '轨迹结束纬度',
|
||||
last_longitude double not null comment '轨迹结束经度',
|
||||
gateway_type varchar(255) null comment '网关类型'
|
||||
)
|
||||
comment '无人机轨迹记录表';
|
||||
|
||||
create table wayline_info
|
||||
(
|
||||
id bigint auto_increment comment '主键 ID'
|
||||
primary key,
|
||||
created_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
file_name varchar(255) not null comment '航线内容文件名称',
|
||||
file_path varchar(255) not null comment '文件在 OSS 的路径',
|
||||
file_md5 varchar(64) null comment '文件md5',
|
||||
content mediumtext not null comment 'JSON 格式的航线内容',
|
||||
drone_model varchar(255) null comment '无人机型号',
|
||||
payloads varchar(255) null comment '载荷型号列表',
|
||||
deleted int default 0 not null comment '是否删除,0 为未删除,1 为已删除'
|
||||
)
|
||||
comment '航线信息';
|
||||
|
||||
alter table wayline_info
|
||||
modify content mediumtext not null comment 'JSON 格式的航线内容';
|
||||
|
||||
ALTER TABLE storage_files
|
||||
ADD COLUMN pilot_photo_fingerprint VARCHAR(255) NULL DEFAULT NULL COMMENT 'pilot2上传的照片标识';
|
||||
|
||||
ALTER TABLE `wayline_info` ADD INDEX `idx_file_path` (`file_path`);
|
||||
Reference in New Issue
Block a user