完善数据库脚本

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,5 +1,6 @@
/*建表*/ /*建表*/
create table wvp_device ( create table wvp_device
(
id serial primary key, id serial primary key,
device_id character varying(50) not null, device_id character varying(50) not null,
name character varying(255), name character varying(255),
@ -35,7 +36,8 @@ create table wvp_device (
constraint uk_device_device unique (device_id) constraint uk_device_device unique (device_id)
); );
create table wvp_device_alarm ( create table wvp_device_alarm
(
id serial primary key, id serial primary key,
device_id character varying(50) not null, device_id character varying(50) not null,
channel_id character varying(50) not null, channel_id character varying(50) not null,
@ -49,53 +51,8 @@ create table wvp_device_alarm (
create_time character varying(50) not null 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,
name character varying(255),
custom_name character varying(255),
manufacture character varying(50),
model character varying(50),
owner character varying(50),
civil_code character varying(50),
block character varying(50),
address character varying(50),
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 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 (
id serial primary key, id serial primary key,
device_id character varying(50) not null, device_id character varying(50) not null,
channel_id character varying(50) not null, channel_id character varying(50) not null,
@ -114,7 +71,8 @@ create table wvp_device_mobile_position (
create_time character varying(50) create_time character varying(50)
); );
create table wvp_gb_stream ( create table wvp_gb_stream
(
gb_stream_id serial primary key, gb_stream_id serial primary key,
app character varying(255) not null, app character varying(255) not null,
stream character varying(255) not null, stream character varying(255) not null,
@ -129,19 +87,129 @@ create table wvp_gb_stream (
constraint uk_gb_stream_unique_app_stream unique (app, stream) constraint uk_gb_stream_unique_app_stream unique (app, stream)
); );
create table wvp_log ( create table wvp_log
(
id serial primary key, id serial primary key,
name character varying(50), name character varying(50),
type character varying(50), type character varying(50),
uri character varying(200), uri character varying(200),
address character varying(50), address character varying(50),
result character varying(50), result character varying(50),
timing bigint, timing int8,
username character varying(50), username character varying(50),
create_time character varying(50) create_time character varying(50)
); );
create table wvp_media_server ( create table wvp_device_channel
(
id serial primary key,
device_db_id integer,
device_id character varying(50),
name character varying(255),
manufacturer character varying(50),
model character varying(50),
owner 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
(
id character varying(255) primary key, id character varying(255) primary key,
ip character varying(50), ip character varying(50),
hook_ip character varying(50), hook_ip character varying(50),
@ -175,7 +243,8 @@ create table wvp_media_server (
constraint uk_media_server_unique_ip_http_port unique (ip, http_port) constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
); );
create table wvp_platform ( create table wvp_platform
(
id serial primary key, id serial primary key,
enable bool default false, enable bool default false,
name character varying(255), name character varying(255),
@ -191,64 +260,103 @@ create table wvp_platform (
expires character varying(50), expires character varying(50),
keep_timeout character varying(50), keep_timeout character varying(50),
transport character varying(50), transport character varying(50),
civil_code character varying(50),
manufacturer character varying(255),
model character varying(255),
address character varying(255),
character_set character varying(50), character_set character varying(50),
catalog_id character varying(50),
ptz bool default false, ptz bool default false,
rtcp bool default false, rtcp bool default false,
status bool default false, status bool default false,
start_offline_push bool default false,
administrative_division character varying(50),
catalog_group integer, catalog_group integer,
register_way integer,
secrecy integer,
create_time character varying(50), create_time character varying(50),
update_time character varying(50), update_time character varying(50),
as_message_channel bool default false, as_message_channel bool default false,
auto_push_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), send_stream_ip character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id) constraint uk_platform_unique_server_gb_id unique (server_gb_id)
); );
create table wvp_platform_catalog (
id character varying(50),
platform_id character varying(50),
name character varying(255),
parent_id character varying(50),
civil_code character varying(50),
business_group_id character varying(50),
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
);
create table wvp_platform_channel ( create table wvp_platform_channel
(
id serial primary key, id serial primary key,
platform_id character varying(50), platform_id integer,
catalog_id character varying(50),
device_channel_id integer, device_channel_id integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) custom_device_id character varying(50),
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_gb_stream ( create table wvp_platform_group
(
id serial primary key, id serial primary key,
platform_id character varying(50), platform_id integer,
catalog_id character varying(50), group_id integer,
gb_stream_id integer, constraint uk_wvp_platform_group_id_catalog_platform_id_group_id unique (platform_id, group_id)
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
); );
create table wvp_stream_proxy ( create table wvp_platform_region
(
id serial primary key,
platform_id integer,
region_id integer,
constraint uk_wvp_platform_group_id_catalog_platform_id_group_id unique (platform_id, region_id)
);
create table wvp_stream_proxy
(
id serial primary key, id serial primary key,
type character varying(50), type character varying(50),
app character varying(255), app character varying(255),
stream character varying(255), stream character varying(255),
url 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),
rtp_type character varying(50), rtsp_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),
@ -258,25 +366,24 @@ create table wvp_stream_proxy (
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, id serial primary key,
app character varying(255), app character varying(255),
stream character varying(255), stream character varying(255),
total_reader_count character varying(50),
origin_type integer,
origin_type_str character varying(50),
create_time character varying(50), create_time character varying(50),
alive_second integer,
media_server_id character varying(50), media_server_id character varying(50),
server_id character varying(50), server_id character varying(50),
push_time character varying(50), push_time character varying(50),
status bool default false, status bool default false,
update_time character varying(50), update_time character varying(50),
push_ing bool default false, pushing bool default false,
self bool default false, self bool default false,
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream) constraint uk_stream_push_app_stream unique (app, stream)
); );
create table wvp_cloud_record ( create table wvp_cloud_record
(
id serial primary key, id serial primary key,
app character varying(255), app character varying(255),
stream character varying(255), stream character varying(255),
@ -293,7 +400,8 @@ create table wvp_cloud_record (
constraint uk_stream_push_app_stream_path unique (app, stream, file_path) constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
); );
create table wvp_user ( create table wvp_user
(
id serial primary key, id serial primary key,
username character varying(255), username character varying(255),
password character varying(255), password character varying(255),
@ -304,14 +412,16 @@ create table wvp_user (
constraint uk_user_username unique (username) constraint uk_user_username unique (username)
); );
create table wvp_user_role ( create table wvp_user_role
(
id serial primary key, id serial primary key,
name character varying(50), name character varying(50),
authority character varying(50), authority character varying(50),
create_time character varying(50), create_time character varying(50),
update_time character varying(50) update_time character varying(50)
); );
create table wvp_resources_tree ( create table wvp_resources_tree
(
id serial primary key, id serial primary key,
is_catalog bool default true, is_catalog bool default true,
device_channel_id integer, device_channel_id integer,
@ -321,12 +431,13 @@ create table wvp_resources_tree (
path character varying(255) path character varying(255)
); );
create table wvp_user_api_key ( create table wvp_user_api_key
(
id serial primary key, id serial primary key,
user_id bigint, user_id int8,
app character varying(255), app character varying(255),
api_key text, api_key text,
expired_at bigint, expired_at int8,
remark character varying(255), remark character varying(255),
enable bool default true, enable bool default true,
create_time character varying(50), create_time character varying(50),
@ -335,8 +446,35 @@ create table wvp_user_api_key (
/*初始数据*/ /*初始数据*/
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)
);