完善数据库脚本

pull/1642/head
648540858 2024-09-13 15:49:46 +08:00
parent 614ff4c71e
commit 56230b84ec
3 changed files with 440 additions and 403 deletions

View File

@ -1,342 +1,480 @@
/*建表*/ /*建表*/
create table wvp_device ( create table wvp_device
id serial primary key , (
device_id character varying(50) not null , id serial primary key,
name character varying(255), device_id character varying(50) not null,
manufacturer character varying(255), name character varying(255),
model character varying(255), manufacturer character varying(255),
firmware character varying(255), model character varying(255),
transport character varying(50), firmware character varying(255),
stream_mode character varying(50), transport character varying(50),
on_line bool default false, stream_mode character varying(50),
register_time character varying(50), on_line bool default false,
keepalive_time character varying(50), register_time character varying(50),
ip character varying(50), keepalive_time character varying(50),
create_time character varying(50), ip character varying(50),
update_time character varying(50), create_time character varying(50),
port integer, update_time character varying(50),
expires integer, port integer,
subscribe_cycle_for_catalog integer DEFAULT 0, expires integer,
subscribe_cycle_for_mobile_position integer DEFAULT 0, subscribe_cycle_for_catalog integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5, subscribe_cycle_for_mobile_position integer DEFAULT 0,
subscribe_cycle_for_alarm integer DEFAULT 0, mobile_position_submission_interval integer DEFAULT 5,
host_address character varying(50), subscribe_cycle_for_alarm integer DEFAULT 0,
charset character varying(50), host_address character varying(50),
ssrc_check bool default false, charset character varying(50),
geo_coord_sys character varying(50), ssrc_check bool default false,
media_server_id character varying(50), geo_coord_sys character varying(50),
custom_name character varying(255), media_server_id character varying(50),
sdp_ip character varying(50), custom_name character varying(255),
local_ip character varying(50), sdp_ip character varying(50),
password character varying(255), local_ip character varying(50),
as_message_channel bool default false, password character varying(255),
keepalive_interval_time integer, as_message_channel bool default false,
broadcast_push_after_ack bool default false, keepalive_interval_time integer,
constraint uk_device_device unique (device_id) broadcast_push_after_ack bool default false,
constraint uk_device_device unique (device_id)
); );
create table wvp_device_alarm ( create table wvp_device_alarm
id serial primary key , (
device_id character varying(50) not null, id serial primary key,
channel_id character varying(50) not null, device_id character varying(50) not null,
alarm_priority character varying(50), channel_id character varying(50) not null,
alarm_method character varying(50), alarm_priority character varying(50),
alarm_time character varying(50), alarm_method character varying(50),
alarm_description character varying(255), alarm_time character varying(50),
longitude double precision, alarm_description character varying(255),
latitude double precision, longitude double precision,
alarm_type character varying(50), latitude double precision,
create_time character varying(50) not null alarm_type character varying(50),
create_time character varying(50) not null
); );
create table wvp_device_channel ( create table wvp_device_mobile_position
id serial primary key , (
channel_id character varying(50) not null, id serial primary key,
name character varying(255), device_id character varying(50) not null,
custom_name character varying(255), channel_id character varying(50) not null,
manufacture character varying(50), device_name character varying(255),
model character varying(50), time character varying(50),
owner character varying(50), longitude double precision,
civil_code character varying(50), latitude double precision,
block character varying(50), altitude double precision,
address character varying(50), speed double precision,
parent_id character varying(50), direction double precision,
safety_way integer, report_source character varying(50),
register_way integer, longitude_gcj02 double precision,
cert_num character varying(50), latitude_gcj02 double precision,
certifiable integer, longitude_wgs84 double precision,
err_code integer, latitude_wgs84 double precision,
end_time character varying(50), create_time character varying(50)
secrecy character varying(50),
ip_address character varying(50),
port integer,
password character varying(255),
ptz_type integer,
custom_ptz_type integer,
status bool default false,
longitude double precision,
custom_longitude double precision,
latitude double precision,
custom_latitude double precision,
stream_id character varying(255),
device_id character varying(50) not null,
parental character varying(50),
has_audio bool default false,
create_time character varying(50) not null,
update_time character varying(50) not null,
sub_count integer,
longitude_gcj02 double precision,
latitude_gcj02 double precision,
longitude_wgs84 double precision,
latitude_wgs84 double precision,
business_group_id character varying(50),
gps_time character varying(50),
stream_identification character varying(50),
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
); );
create table wvp_device_mobile_position ( create table wvp_gb_stream
id serial primary key, (
device_id character varying(50) not null, gb_stream_id serial primary key,
channel_id character varying(50) not null, app character varying(255) not null,
device_name character varying(255), stream character varying(255) not null,
time character varying(50), gb_id character varying(50) not null,
longitude double precision, name character varying(255),
latitude double precision, longitude double precision,
altitude double precision, latitude double precision,
speed double precision, stream_type character varying(50),
direction double precision, media_server_id character varying(50),
report_source character varying(50), create_time character varying(50),
longitude_gcj02 double precision, constraint uk_gb_stream_unique_gb_id unique (gb_id),
latitude_gcj02 double precision, constraint uk_gb_stream_unique_app_stream unique (app, stream)
longitude_wgs84 double precision,
latitude_wgs84 double precision,
create_time character varying(50)
); );
create table wvp_gb_stream ( create table wvp_log
gb_stream_id serial primary key, (
app character varying(255) not null, id serial primary key,
stream character varying(255) not null, name character varying(50),
gb_id character varying(50) not null, type character varying(50),
name character varying(255), uri character varying(200),
longitude double precision, address character varying(50),
latitude double precision, result character varying(50),
stream_type character varying(50), timing int8,
media_server_id character varying(50), username character varying(50),
create_time character varying(50), create_time character varying(50)
constraint uk_gb_stream_unique_gb_id unique (gb_id),
constraint uk_gb_stream_unique_app_stream unique (app, stream)
); );
create table wvp_log ( create table wvp_device_channel
id serial primary key , (
name character varying(50), id serial primary key,
type character varying(50), device_db_id integer,
uri character varying(200), device_id character varying(50),
address character varying(50), name character varying(255),
result character varying(50), manufacturer character varying(50),
timing bigint, model character varying(50),
username character varying(50), owner character varying(50),
create_time character varying(50) civil_code character varying(50),
block character varying(50),
address character varying(50),
parental integer,
parent_id character varying(50),
safety_way integer,
register_way integer,
cert_num character varying(50),
certifiable integer,
err_code integer,
end_time character varying(50),
secrecy integer,
ip_address character varying(50),
port integer,
password character varying(255),
status character varying(50),
longitude double precision,
latitude double precision,
ptz_type integer,
position_type integer,
room_type integer,
use_type integer,
supply_light_type integer,
direction_type integer,
resolution character varying(255),
business_group_id character varying(255),
download_speed character varying(255),
svc_space_support_mod integer,
svc_time_support_mode integer,
create_time character varying(50) not null,
update_time character varying(50) not null,
sub_count integer,
stream_id character varying(255),
has_audio bool default false,
gps_time character varying(50),
stream_identification character varying(50),
channel_type int default 0 not null,
gb_device_id character varying(50),
gb_name character varying(255),
gb_manufacturer character varying(255),
gb_model character varying(255),
gb_owner character varying(255),
gb_civil_code character varying(255),
gb_block character varying(255),
gb_address character varying(255),
gb_parental integer,
gb_parent_id character varying(255),
gb_safety_way integer,
gb_register_way integer,
gb_cert_num integer,
gb_certifiable integer,
gb_err_code integer,
gb_end_time integer,
gb_security_level_code character varying(255),
gb_secrecy integer,
gb_ip_address character varying(50),
gb_port integer,
gb_password character varying(50),
gb_status character varying(50),
gb_longitude double,
gb_latitude double,
gb_business_group_id character varying(50),
gb_ptz_type integer,
gb_position_type integer,
gb_photoelectric_imaging_typ integer,
gb_capture_position_type integer,
gb_room_type integer,
gb_use_type integer,
gb_supply_light_type integer,
gb_direction_type integer,
gb_resolution character varying(255),
gb_stream_number_list character varying(255),
gb_download_speed character varying(255),
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
gb_ssvc_ratio_support_list character varying(255),
gb_mobile_device_type integer,
gb_horizontal_field_angle double,
gb_vertical_field_angle double,
gb_max_view_distance double,
gb_grassroots_code character varying(255),
gb_po_type integer,
gb_po_common_name character varying(255),
gb_mac character varying(255),
gb_function_type character varying(255),
gb_encode_type character varying(255),
gb_install_time character varying(255),
gb_management_unit character varying(255),
gb_contact_info character varying(255),
gb_record_save_days integer,
gb_industrial_classification character varying(255),
stream_push_id integer,
stream_proxy_id integer,
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
constraint uk_wvp_unique_channel unique (gb_device_id),
constraint uk_wvp_unique_stream_push_id unique (stream_push_id),
constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id)
); );
create table wvp_media_server ( create table wvp_media_server
id character varying(255) primary key , (
ip character varying(50), id character varying(255) primary key,
hook_ip character varying(50), ip character varying(50),
sdp_ip character varying(50), hook_ip character varying(50),
stream_ip character varying(50), sdp_ip character varying(50),
http_port integer, stream_ip character varying(50),
http_ssl_port integer, http_port integer,
rtmp_port integer, http_ssl_port integer,
rtmp_ssl_port integer, rtmp_port integer,
rtp_proxy_port integer, rtmp_ssl_port integer,
rtsp_port integer, rtp_proxy_port integer,
rtsp_ssl_port integer, rtsp_port integer,
flv_port integer, rtsp_ssl_port integer,
flv_ssl_port integer, flv_port integer,
ws_flv_port integer, flv_ssl_port integer,
ws_flv_ssl_port integer, ws_flv_port integer,
auto_config bool default false, ws_flv_ssl_port integer,
secret character varying(50), auto_config bool default false,
type character varying(50) default 'zlm', secret character varying(50),
rtp_enable bool default false, type character varying(50) default 'zlm',
rtp_port_range character varying(50), rtp_enable bool default false,
send_rtp_port_range character varying(50), rtp_port_range character varying(50),
record_assist_port integer, send_rtp_port_range character varying(50),
default_server bool default false, record_assist_port integer,
create_time character varying(50), default_server bool default false,
update_time character varying(50), create_time character varying(50),
hook_alive_interval integer, update_time character varying(50),
record_path character varying(255), hook_alive_interval integer,
record_day integer default 7, record_path character varying(255),
transcode_suffix character varying(255), record_day integer default 7,
constraint uk_media_server_unique_ip_http_port unique (ip, http_port) transcode_suffix character varying(255),
constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
); );
create table wvp_platform ( create table wvp_platform
id serial primary key , (
enable bool default false, id serial primary key,
name character varying(255), enable bool default false,
server_gb_id character varying(50), name character varying(255),
server_gb_domain character varying(50), server_gb_id character varying(50),
server_ip character varying(50), server_gb_domain character varying(50),
server_port integer, server_ip character varying(50),
device_gb_id character varying(50), server_port integer,
device_ip character varying(50), device_gb_id character varying(50),
device_port character varying(50), device_ip character varying(50),
username character varying(255), device_port character varying(50),
password character varying(50), username character varying(255),
expires character varying(50), password character varying(50),
keep_timeout character varying(50), expires character varying(50),
transport character varying(50), keep_timeout character varying(50),
character_set character varying(50), transport character varying(50),
catalog_id character varying(50), civil_code character varying(50),
ptz bool default false, manufacturer character varying(255),
rtcp bool default false, model character varying(255),
status bool default false, address character varying(255),
start_offline_push bool default false, character_set character varying(50),
administrative_division character varying(50), ptz bool default false,
catalog_group integer, rtcp bool default false,
create_time character varying(50), status bool default false,
update_time character varying(50), catalog_group integer,
as_message_channel bool default false, register_way integer,
auto_push_channel bool default false, secrecy integer,
send_stream_ip character varying(50), create_time character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id) update_time character varying(50),
as_message_channel bool default false,
catalog_with_platform bool default true,
catalog_with_group bool default true,
catalog_with_region bool default true,
auto_push_channel bool default true,
send_stream_ip character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
); );
create table wvp_platform_catalog (
id character varying(50), create table wvp_platform_channel
platform_id character varying(50), (
name character varying(255), id serial primary key,
parent_id character varying(50), platform_id integer,
civil_code character varying(50), device_channel_id integer,
business_group_id character varying(50), custom_device_id character varying(50),
constraint uk_platform_catalog_id_platform_id unique (id, platform_id) custom_name character varying(255),
custom_manufacturer character varying(50),
custom_model character varying(50),
custom_owner character varying(50),
custom_civil_code character varying(50),
custom_block character varying(50),
custom_address character varying(50),
custom_parental integer,
custom_parent_id character varying(50),
custom_safety_way integer,
custom_register_way integer,
custom_cert_num character varying(50),
custom_certifiable integer,
custom_err_code integer,
custom_end_time character varying(50),
custom_secrecy integer,
custom_ip_address character varying(50),
custom_port integer,
custom_password character varying(255),
custom_status character varying(50),
custom_longitude double precision,
custom_latitude double precision,
custom_ptz_type integer,
custom_position_type integer,
custom_room_type integer,
custom_use_type integer,
custom_supply_light_type integer,
custom_direction_type integer,
custom_resolution character varying(255),
custom_business_group_id character varying(255),
custom_download_speed character varying(255),
custom_svc_space_support_mod integer,
custom_svc_time_support_mode integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, device_channel_id),
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
); );
create table wvp_platform_channel ( create table wvp_platform_group
id serial primary key , (
platform_id character varying(50), id serial primary key,
catalog_id character varying(50), platform_id integer,
device_channel_id integer, group_id integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) constraint uk_wvp_platform_group_id_catalog_platform_id_group_id unique (platform_id, group_id)
); );
create table wvp_platform_gb_stream ( create table wvp_platform_region
id serial primary key, (
platform_id character varying(50), id serial primary key,
catalog_id character varying(50), platform_id integer,
gb_stream_id integer, region_id integer,
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id) constraint uk_wvp_platform_group_id_catalog_platform_id_group_id unique (platform_id, region_id)
); );
create table wvp_stream_proxy ( create table wvp_stream_proxy
id serial primary key, (
type character varying(50), id serial primary key,
app character varying(255), type character varying(50),
stream character varying(255), app character varying(255),
url character varying(255), stream character varying(255),
src_url character varying(255), src_url character varying(255),
dst_url character varying(255), timeout integer,
timeout_ms integer, ffmpeg_cmd_key character varying(255),
ffmpeg_cmd_key character varying(255), rtsp_type character varying(50),
rtp_type character varying(50), media_server_id character varying(50),
media_server_id character varying(50), enable_audio bool default false,
enable_audio bool default false, enable_mp4 bool default false,
enable_mp4 bool default false, pulling bool default false,
enable bool default false, enable bool default false,
status boolean, enable_remove_none_reader bool default false,
enable_remove_none_reader bool default false, create_time character varying(50),
create_time character varying(50), name character varying(255),
name character varying(255), update_time character varying(50),
update_time character varying(50), stream_key character varying(255),
stream_key character varying(255), enable_disable_none_reader bool default false,
enable_disable_none_reader bool default false, constraint uk_stream_proxy_app_stream unique (app, stream)
constraint uk_stream_proxy_app_stream unique (app, stream)
); );
create table wvp_stream_push ( create table wvp_stream_push
id serial primary key, (
app character varying(255), id serial primary key,
stream character varying(255), app character varying(255),
total_reader_count character varying(50), stream character varying(255),
origin_type integer, create_time character varying(50),
origin_type_str character varying(50), media_server_id character varying(50),
create_time character varying(50), server_id character varying(50),
alive_second integer, push_time character varying(50),
media_server_id character varying(50), status bool default false,
server_id character varying(50), update_time character varying(50),
push_time character varying(50), pushing bool default false,
status bool default false, self bool default false,
update_time character varying(50), start_offline_push bool default true,
push_ing bool default false, constraint uk_stream_push_app_stream unique (app, stream)
self bool default false,
constraint uk_stream_push_app_stream unique (app, stream)
); );
create table wvp_cloud_record ( create table wvp_cloud_record
id serial primary key, (
app character varying(255), id serial primary key,
stream character varying(255), app character varying(255),
call_id character varying(255), stream character varying(255),
start_time int8, call_id character varying(255),
end_time int8, start_time int8,
media_server_id character varying(50), end_time int8,
file_name character varying(255), media_server_id character varying(50),
folder character varying(255), file_name character varying(255),
file_path character varying(255), folder character varying(255),
collect bool default false, file_path character varying(255),
file_size int8, collect bool default false,
time_len int8, file_size int8,
constraint uk_stream_push_app_stream_path unique (app, stream, file_path) time_len int8,
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
); );
create table wvp_user ( create table wvp_user
id serial primary key, (
username character varying(255), id serial primary key,
password character varying(255), username character varying(255),
role_id integer, password character varying(255),
create_time character varying(50), role_id integer,
update_time character varying(50), create_time character varying(50),
push_key character varying(50), update_time character varying(50),
constraint uk_user_username unique (username) push_key character varying(50),
constraint uk_user_username unique (username)
); );
create table wvp_user_role ( create table wvp_user_role
id serial primary key, (
name character varying(50), id serial primary key,
authority character varying(50), name character varying(50),
create_time character varying(50), authority character varying(50),
update_time character varying(50) create_time character varying(50),
update_time character varying(50)
); );
create table wvp_resources_tree ( create table wvp_resources_tree
id serial primary key , (
is_catalog bool default true, id serial primary key,
device_channel_id integer , is_catalog bool default true,
gb_stream_id integer, device_channel_id integer,
name character varying(255), gb_stream_id integer,
parentId integer, name character varying(255),
path character varying(255) parentId integer,
path character varying(255)
); );
create table wvp_user_api_key ( create table wvp_user_api_key
id serial primary key , (
user_id bigint, id serial primary key,
app character varying(255) , user_id int8,
api_key text, app character varying(255),
expired_at bigint, api_key text,
remark character varying(255), expired_at int8,
enable bool default true, remark character varying(255),
create_time character varying(50), enable bool default true,
update_time character varying(50) create_time character varying(50),
update_time character varying(50)
); );
/*初始数据*/ /*初始数据*/
INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3'); INSERT INTO wvp_user
INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57', '2021-04-13 14:14:57',
'3e80d1762a324d5b0ff636e0bd16f1e3');
INSERT INTO wvp_user_role
VALUES (1, 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57');
CREATE TABLE wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
name varchar(255) NOT NULL,
parent_id int,
parent_device_id varchar(50) DEFAULT NULL,
business_group varchar(50) NOT NULL,
create_time varchar(50) NOT NULL,
update_time varchar(50) NOT NULL,
civil_code varchar(50) default null,
UNIQUE KEY common_group_device_platform (device_id)
);
CREATE TABLE wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
name varchar(255) NOT NULL,
parent_id int,
parent_device_id varchar(50) DEFAULT NULL,
create_time varchar(50) NOT NULL,
update_time varchar(50) NOT NULL,
UNIQUE KEY common_region_device_id (device_id)
);

View File

@ -1,75 +0,0 @@
alter table wvp_device_channel
drop column custom_name;
alter table wvp_device_channel
drop column channel_id;
alter table wvp_device_channel
drop column custom_longitude;
alter table wvp_device_channel
drop column custom_latitude;
alter table wvp_device_channel
drop column custom_ptz_type;
alter table wvp_device_channel
drop column longitude_gcj02;
alter table wvp_device_channel
drop column latitude_gcj02;
alter table wvp_device_channel
drop column longitude_wgs84;
alter table wvp_device_channel
drop column latitude_wgs84;
alter table wvp_device_channel
rename column manufacture to manufacturer;
alter table wvp_device_channel
modify column parental integer;
alter table wvp_device_channel
modify column secrecy integer;
alter table wvp_device_channel
modify column status character varying(50);
alter table wvp_device_channel
modify column device_id character varying(50);
alter table wvp_device_channel
add position_type integer;
alter table wvp_device_channel
add room_type integer;
alter table wvp_device_channel
add use_type integer;
alter table wvp_device_channel
add supply_light_type integer;
alter table wvp_device_channel
add direction_type integer;
alter table wvp_device_channel
add resolution character varying(255);
alter table wvp_device_channel
modify column business_group_id character varying(255);
alter table wvp_device_channel
add download_speed character varying(255);
alter table wvp_device_channel
add svc_space_support_mod integer;
alter table wvp_device_channel
add svc_time_support_mode integer;
alter table wvp_device_channel
add device_db_id integer;

View File

@ -1,26 +0,0 @@
alter table wvp_media_server
add transcode_suffix character varying(255);
alter table wvp_media_server
add type character varying(50) default 'zlm';
alter table wvp_media_server
add flv_port integer;
alter table wvp_media_server
add flv_ssl_port integer;
alter table wvp_media_server
add ws_flv_port integer;
alter table wvp_media_server
add ws_flv_ssl_port integer;
create table wvp_user_api_key (
id serial primary key ,
user_id bigint,
app character varying(255) ,
api_key text,
expired_at bigint,
remark character varying(255),
enable bool default true,
create_time character varying(50),
update_time character varying(50)
);