Merge branch 'master' into 重构/1078

This commit is contained in:
lin
2025-03-24 15:19:07 +08:00
39 changed files with 1382 additions and 1379 deletions

View File

@@ -1,5 +1,6 @@
/*建表*/
create table wvp_device
drop table IF EXISTS wvp_device;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
@@ -39,7 +40,8 @@ create table wvp_device
constraint uk_device_device unique (device_id)
);
create table wvp_device_alarm
drop table IF EXISTS wvp_device_alarm;
create table IF NOT EXISTS wvp_device_alarm
(
id serial primary key,
device_id character varying(50) not null,
@@ -54,7 +56,8 @@ create table wvp_device_alarm
create_time character varying(50) not null
);
create table wvp_device_mobile_position
drop table IF EXISTS wvp_device_mobile_position;
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
@@ -70,7 +73,8 @@ create table wvp_device_mobile_position
create_time character varying(50)
);
create table wvp_device_channel
drop table IF EXISTS wvp_device_channel;
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
@@ -152,10 +156,14 @@ create table wvp_device_channel
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table wvp_media_server
drop table IF EXISTS wvp_media_server;
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
@@ -191,7 +199,8 @@ create table wvp_media_server
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table wvp_platform
drop table IF EXISTS wvp_platform;
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
@@ -231,8 +240,8 @@ create table wvp_platform
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table wvp_platform_channel
drop table IF EXISTS wvp_platform_channel;
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
@@ -275,7 +284,8 @@ create table wvp_platform_channel
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table wvp_platform_group
drop table IF EXISTS wvp_platform_group;
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
@@ -283,7 +293,8 @@ create table wvp_platform_group
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table wvp_platform_region
drop table IF EXISTS wvp_platform_region;
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
@@ -291,7 +302,8 @@ create table wvp_platform_region
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table wvp_stream_proxy
drop table IF EXISTS wvp_stream_proxy;
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
@@ -317,7 +329,8 @@ create table wvp_stream_proxy
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table wvp_stream_push
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
@@ -333,7 +346,9 @@ create table wvp_stream_push
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table wvp_cloud_record
drop table IF EXISTS wvp_cloud_record;
create table IF NOT EXISTS wvp_cloud_record
(
id serial primary key,
app character varying(255),
@@ -351,7 +366,8 @@ create table wvp_cloud_record
time_len bigint
);
create table wvp_user
drop table IF EXISTS wvp_user;
create table IF NOT EXISTS wvp_user
(
id serial primary key,
username character varying(255),
@@ -363,7 +379,8 @@ create table wvp_user
constraint uk_user_username unique (username)
);
create table wvp_user_role
drop table IF EXISTS wvp_user_role;
create table IF NOT EXISTS wvp_user_role
(
id serial primary key,
name character varying(50),
@@ -371,18 +388,10 @@ create table wvp_user_role
create_time character varying(50),
update_time character varying(50)
);
create table wvp_resources_tree
(
id serial primary key,
is_catalog bool default true,
device_channel_id integer,
gb_stream_id integer,
name character varying(255),
parentId integer,
path character varying(255)
);
create table wvp_user_api_key
drop table IF EXISTS wvp_user_api_key;
create table IF NOT EXISTS wvp_user_api_key
(
id serial primary key,
user_id bigint,
@@ -403,7 +412,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57'
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
drop table IF EXISTS wvp_common_group;
create table IF NOT EXISTS wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -417,7 +427,8 @@ CREATE TABLE wvp_common_group
constraint uk_common_group_device_platform unique (device_id)
);
CREATE TABLE wvp_common_region
drop table IF EXISTS wvp_common_region;
create table IF NOT EXISTS wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -429,7 +440,8 @@ CREATE TABLE wvp_common_region
constraint uk_common_region_device_id unique (device_id)
);
create table wvp_record_plan
drop table IF EXISTS wvp_record_plan;
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
@@ -438,7 +450,8 @@ create table wvp_record_plan
update_time character varying(50)
);
create table wvp_record_plan_item
drop table IF EXISTS wvp_record_plan_item;
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
start int,

View File

@@ -1,5 +1,6 @@
/*建表*/
create table wvp_device
drop table IF EXISTS wvp_device;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
@@ -25,7 +26,7 @@ create table wvp_device
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
@@ -39,7 +40,8 @@ create table wvp_device
constraint uk_device_device unique (device_id)
);
create table wvp_device_alarm
drop table IF EXISTS wvp_device_alarm;
create table IF NOT EXISTS wvp_device_alarm
(
id serial primary key,
device_id character varying(50) not null,
@@ -54,7 +56,8 @@ create table wvp_device_alarm
create_time character varying(50) not null
);
create table wvp_device_mobile_position
drop table IF EXISTS wvp_device_mobile_position;
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
@@ -70,7 +73,8 @@ create table wvp_device_mobile_position
create_time character varying(50)
);
create table wvp_device_channel
drop table IF EXISTS wvp_device_channel;
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
@@ -152,10 +156,14 @@ create table wvp_device_channel
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table wvp_media_server
drop table IF EXISTS wvp_media_server;
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
@@ -191,7 +199,8 @@ create table wvp_media_server
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table wvp_platform
drop table IF EXISTS wvp_platform;
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
@@ -231,8 +240,8 @@ create table wvp_platform
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table wvp_platform_channel
drop table IF EXISTS wvp_platform_channel;
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
@@ -275,7 +284,8 @@ create table wvp_platform_channel
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table wvp_platform_group
drop table IF EXISTS wvp_platform_group;
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
@@ -283,7 +293,8 @@ create table wvp_platform_group
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table wvp_platform_region
drop table IF EXISTS wvp_platform_region;
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
@@ -291,7 +302,8 @@ create table wvp_platform_region
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table wvp_stream_proxy
drop table IF EXISTS wvp_stream_proxy;
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
@@ -317,7 +329,8 @@ create table wvp_stream_proxy
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table wvp_stream_push
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
@@ -333,7 +346,9 @@ create table wvp_stream_push
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table wvp_cloud_record
drop table IF EXISTS wvp_cloud_record;
create table IF NOT EXISTS wvp_cloud_record
(
id serial primary key,
app character varying(255),
@@ -348,11 +363,11 @@ create table wvp_cloud_record
file_path character varying(500),
collect bool default false,
file_size int8,
time_len int8,
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
time_len int8
);
create table wvp_user
drop table IF EXISTS wvp_user;
create table IF NOT EXISTS wvp_user
(
id serial primary key,
username character varying(255),
@@ -364,7 +379,8 @@ create table wvp_user
constraint uk_user_username unique (username)
);
create table wvp_user_role
drop table IF EXISTS wvp_user_role;
create table IF NOT EXISTS wvp_user_role
(
id serial primary key,
name character varying(50),
@@ -372,18 +388,10 @@ create table wvp_user_role
create_time character varying(50),
update_time character varying(50)
);
create table wvp_resources_tree
(
id serial primary key,
is_catalog bool default true,
device_channel_id integer,
gb_stream_id integer,
name character varying(255),
parentId integer,
path character varying(255)
);
create table wvp_user_api_key
drop table IF EXISTS wvp_user_api_key;
create table IF NOT EXISTS wvp_user_api_key
(
id serial primary key,
user_id int8,
@@ -404,7 +412,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57'
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
drop table IF EXISTS wvp_common_group;
create table IF NOT EXISTS wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -418,7 +427,8 @@ CREATE TABLE wvp_common_group
constraint uk_common_group_device_platform unique (device_id)
);
CREATE TABLE wvp_common_region
drop table IF EXISTS wvp_common_region;
create table IF NOT EXISTS wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -430,7 +440,8 @@ CREATE TABLE wvp_common_region
constraint uk_common_region_device_id unique (device_id)
);
create table wvp_record_plan
drop table IF EXISTS wvp_record_plan;
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
@@ -439,7 +450,8 @@ create table wvp_record_plan
update_time character varying(50)
);
create table wvp_record_plan_item
drop table IF EXISTS wvp_record_plan_item;
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
"start" int,

View File

@@ -1,13 +0,0 @@
/*
* WVP RPC 调用
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";

View File

@@ -0,0 +1,426 @@
drop table if exists wvp_resources_tree;
drop table if exists wvp_platform_catalog;
drop table if exists wvp_platform_gb_stream;
drop table if exists wvp_platform_gb_channel;
drop table if exists wvp_gb_stream;
drop table if exists wvp_log;
drop table IF EXISTS wvp_device;
drop table IF EXISTS wvp_platform;
drop table IF EXISTS wvp_media_server;
drop table IF EXISTS wvp_device_mobile_position;
drop table IF EXISTS wvp_device_channel;
drop table IF EXISTS wvp_stream_proxy;
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
name character varying(255),
manufacturer character varying(255),
model character varying(255),
firmware character varying(255),
transport character varying(50),
stream_mode character varying(50),
on_line bool default false,
register_time character varying(50),
keepalive_time character varying(50),
ip character varying(50),
create_time character varying(50),
update_time character varying(50),
port integer,
expires integer,
subscribe_cycle_for_catalog integer DEFAULT 0,
subscribe_cycle_for_mobile_position integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5,
subscribe_cycle_for_alarm integer DEFAULT 0,
host_address character varying(50),
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
password character varying(255),
as_message_channel bool default false,
heart_beat_interval integer,
heart_beat_count integer,
position_capability integer,
broadcast_push_after_ack bool default false,
server_id character varying(50),
constraint uk_device_device unique (device_id)
);
create table if not exists wvp_common_group
(
id bigint unsigned auto_increment primary key,
device_id varchar(50) not null,
name varchar(255) not null,
parent_id int null,
parent_device_id varchar(50) null,
business_group varchar(50) not null,
create_time varchar(50) not null,
update_time varchar(50) not null,
civil_code varchar(50) null,
constraint id
unique (id),
constraint uk_common_group_device_platform
unique (device_id)
);
create table if not exists wvp_common_region
(
id bigint unsigned auto_increment
primary key,
device_id varchar(50) not null,
name varchar(255) not null,
parent_id int null,
parent_device_id varchar(50) null,
create_time varchar(50) not null,
update_time varchar(50) not null,
constraint id
unique (id),
constraint uk_common_region_device_id
unique (device_id)
);
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
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 character varying(50),
gb_certifiable integer,
gb_err_code integer,
gb_end_time character varying(50),
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_room_type integer,
gb_use_type integer,
gb_supply_light_type integer,
gb_direction_type integer,
gb_resolution character varying(255),
gb_download_speed character varying(255),
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
channel_id character varying(50) not null,
device_name character varying(255),
time character varying(50),
longitude double precision,
latitude double precision,
altitude double precision,
speed double precision,
direction double precision,
report_source character varying(50),
create_time character varying(50)
);
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
hook_ip character varying(50),
sdp_ip character varying(50),
stream_ip character varying(50),
http_port integer,
http_ssl_port integer,
rtmp_port integer,
rtmp_ssl_port integer,
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',
rtp_enable bool default false,
rtp_port_range character varying(50),
send_rtp_port_range character varying(50),
record_assist_port integer,
default_server bool default false,
create_time character varying(50),
update_time character varying(50),
hook_alive_interval integer,
record_path character varying(255),
record_day integer default 7,
transcode_suffix character varying(255),
server_id character varying(50),
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
name character varying(255),
server_gb_id character varying(50),
server_gb_domain character varying(50),
server_ip character varying(50),
server_port integer,
device_gb_id character varying(50),
device_ip character varying(50),
device_port character varying(50),
username character varying(255),
password character varying(50),
expires character varying(50),
keep_timeout 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),
ptz bool default false,
rtcp bool default false,
status bool default false,
catalog_group integer,
register_way integer,
secrecy integer,
create_time character varying(50),
update_time character varying(50),
as_message_channel bool default false,
catalog_with_platform integer default 1,
catalog_with_group integer default 1,
catalog_with_region integer default 1,
auto_push_channel bool default true,
send_stream_ip character varying(50),
server_id character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
app character varying(255),
stream character varying(255),
src_url character varying(255),
timeout integer,
ffmpeg_cmd_key character varying(255),
rtsp_type character varying(50),
media_server_id character varying(50),
enable_audio bool default false,
enable_mp4 bool default false,
pulling bool default false,
enable bool default false,
enable_remove_none_reader bool default false,
create_time character varying(50),
name character varying(255),
update_time character varying(50),
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
stream character varying(255),
create_time character varying(50),
media_server_id character varying(50),
server_id character varying(50),
push_time character varying(50),
status bool default false,
update_time character varying(50),
pushing bool default false,
self bool default false,
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
device_channel_id integer,
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 IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
group_id integer,
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
region_id integer,
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
name varchar(255) NOT NULL,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
start int,
stop int,
week_day int,
plan_id int,
create_time character varying(50),
update_time character varying(50)
);
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250111`()
BEGIN
DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID';
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path')
THEN
alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder')
THEN
alter table wvp_cloud_record modify folder varchar(500) null;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path')
THEN
alter table wvp_cloud_record modify file_path varchar(500) null;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id')
THEN
alter table wvp_cloud_record add server_id character varying(50);
update wvp_cloud_record set server_id = serverId;
END IF;
END;//
call wvp_20250111();
DROP PROCEDURE wvp_20250111;
DELIMITER ;

View File

@@ -1,64 +1,271 @@
/*
* 20240528
*/
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20240528`()
BEGIN
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'transcode_suffix')
THEN
ALTER TABLE wvp_media_server ADD transcode_suffix character varying(255);
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'type')
THEN
alter table wvp_media_server
add type character varying(50) default 'zlm';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_port')
THEN
alter table wvp_media_server add flv_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_ssl_port')
THEN
alter table wvp_media_server add flv_ssl_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_port')
THEN
alter table wvp_media_server add ws_flv_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_ssl_port')
THEN
alter table wvp_media_server add ws_flv_ssl_port integer;
END IF;
END; //
call wvp_20240528();
DROP PROCEDURE wvp_20240528;
DELIMITER ;
create table IF NOT EXISTS 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)
);
/*
* 20241222
*/
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20241222`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_device_channel_unique_device_channel')
THEN
alter table wvp_device_channel drop index uk_wvp_device_channel_unique_device_channel;
END IF;
alter table wvp_device_channel
add data_type integer not null;
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_push_id')
THEN
alter table wvp_device_channel drop index uk_wvp_unique_stream_push_id;
END IF;
alter table wvp_device_channel
add data_device_id integer not null;
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_proxy_id')
THEN
alter table wvp_device_channel drop index uk_wvp_unique_stream_proxy_id;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_type')
THEN
alter table wvp_device_channel add data_type integer not null;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_device_id')
THEN
alter table wvp_device_channel add data_device_id integer not null;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
alter table wvp_device_channel drop device_db_id;
END IF;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
alter table wvp_device_channel drop stream_push_id;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null;
alter table wvp_device_channel drop stream_proxy_id;
END IF;
END; //
call wvp_20241222();
DROP PROCEDURE wvp_20241222;
DELIMITER ;
/*
* 20241231
*/
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
DELIMITER //
CREATE PROCEDURE `wvp_20241231`()
BEGIN
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'relates_media_server_id')
THEN
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
END IF;
END; //
call wvp_20241231();
DROP PROCEDURE wvp_20241231;
DELIMITER ;
/*
* 20250111
*/
drop index uk_stream_push_app_stream_path on wvp_cloud_record;
alter table wvp_cloud_record change folder folder varchar(500) null;
alter table wvp_cloud_record change file_path file_path varchar(500) null;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250111`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path')
THEN
alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder')
THEN
alter table wvp_cloud_record modify folder varchar(500) null;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path')
THEN
alter table wvp_cloud_record modify file_path varchar(500) null;
END IF;
END; //
call wvp_20250111();
DROP PROCEDURE wvp_20250111;
DELIMITER ;
/*
* 20250211
*/
alter table wvp_device change keepalive_interval_time heart_beat_interval integer;
alter table wvp_device add heart_beat_count integer;
alter table wvp_device add position_capability integer;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250211`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'keepalive_interval_time')
THEN
alter table wvp_device change keepalive_interval_time heart_beat_interval integer after as_message_channel;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'heart_beat_count')
THEN
alter table wvp_device add heart_beat_count integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'position_capability')
THEN
alter table wvp_device add position_capability integer;
END IF;
END; //
call wvp_20250211();
DROP PROCEDURE wvp_20250211;
DELIMITER ;
/**
* 20250312
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250312`()
BEGIN
DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID';
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'server_id')
THEN
alter table wvp_device add server_id character varying(50);
update wvp_device set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'server_id')
THEN
alter table wvp_media_server add server_id character varying(50);
update wvp_media_server set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'server_id')
THEN
alter table wvp_stream_proxy add server_id character varying(50);
update wvp_stream_proxy set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id')
THEN
alter table wvp_cloud_record add server_id character varying(50);
update wvp_cloud_record set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_platform' and column_name = 'server_id')
THEN
alter table wvp_platform add server_id character varying(50);
END IF;
END; //
call wvp_20250312();
DROP PROCEDURE wvp_20250312;
DELIMITER ;
/*
* 20250319
*/
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250319`()
BEGIN
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_speed')
THEN
alter table wvp_device_channel add gps_speed double precision;
END IF;
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_altitude')
THEN
alter table wvp_device_channel add gps_altitude double precision;
END IF;
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_direction')
THEN
alter table wvp_device_channel add gps_direction double precision;
END IF;
END; //
call wvp_20250319();
DROP PROCEDURE wvp_20250319;
DELIMITER ;
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";

View File

@@ -0,0 +1,387 @@
drop table if exists wvp_resources_tree;
drop table if exists wvp_platform_catalog;
drop table if exists wvp_platform_gb_stream;
drop table if exists wvp_platform_gb_channel;
drop table if exists wvp_gb_stream;
drop table if exists wvp_log;
drop table IF EXISTS wvp_device;
drop table IF EXISTS wvp_platform;
drop table IF EXISTS wvp_media_server;
drop table IF EXISTS wvp_device_mobile_position;
drop table IF EXISTS wvp_device_channel;
drop table IF EXISTS wvp_stream_proxy;
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
name character varying(255),
manufacturer character varying(255),
model character varying(255),
firmware character varying(255),
transport character varying(50),
stream_mode character varying(50),
on_line bool default false,
register_time character varying(50),
keepalive_time character varying(50),
ip character varying(50),
create_time character varying(50),
update_time character varying(50),
port integer,
expires integer,
subscribe_cycle_for_catalog integer DEFAULT 0,
subscribe_cycle_for_mobile_position integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5,
subscribe_cycle_for_alarm integer DEFAULT 0,
host_address character varying(50),
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
password character varying(255),
as_message_channel bool default false,
heart_beat_interval integer,
heart_beat_count integer,
position_capability integer,
broadcast_push_after_ack bool default false,
server_id character varying(50),
constraint uk_device_device unique (device_id)
);
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
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 character varying(50),
gb_certifiable integer,
gb_err_code integer,
gb_end_time character varying(50),
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 precision,
gb_latitude double precision,
gb_business_group_id character varying(50),
gb_ptz_type integer,
gb_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_download_speed character varying(255),
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
channel_id character varying(50) not null,
device_name character varying(255),
time character varying(50),
longitude double precision,
latitude double precision,
altitude double precision,
speed double precision,
direction double precision,
report_source character varying(50),
create_time character varying(50)
);
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
hook_ip character varying(50),
sdp_ip character varying(50),
stream_ip character varying(50),
http_port integer,
http_ssl_port integer,
rtmp_port integer,
rtmp_ssl_port integer,
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',
rtp_enable bool default false,
rtp_port_range character varying(50),
send_rtp_port_range character varying(50),
record_assist_port integer,
default_server bool default false,
create_time character varying(50),
update_time character varying(50),
hook_alive_interval integer,
record_path character varying(255),
record_day integer default 7,
transcode_suffix character varying(255),
server_id character varying(50),
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table IF NOT EXISTS 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,
constraint uk_common_group_device_platform unique (device_id)
);
create table IF NOT EXISTS 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,
constraint uk_common_region_device_id unique (device_id)
);
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
name varchar(255) NOT NULL,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
"start" int,
stop int,
week_day int,
plan_id int,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
name character varying(255),
server_gb_id character varying(50),
server_gb_domain character varying(50),
server_ip character varying(50),
server_port integer,
device_gb_id character varying(50),
device_ip character varying(50),
device_port character varying(50),
username character varying(255),
password character varying(50),
expires character varying(50),
keep_timeout 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),
ptz bool default false,
rtcp bool default false,
status bool default false,
catalog_group integer,
register_way integer,
secrecy integer,
create_time character varying(50),
update_time character varying(50),
as_message_channel bool default false,
catalog_with_platform integer default 1,
catalog_with_group integer default 1,
catalog_with_region integer default 1,
auto_push_channel bool default true,
send_stream_ip character varying(50),
server_id character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
device_channel_id integer,
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 IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
group_id integer,
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
region_id integer,
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
app character varying(255),
stream character varying(255),
src_url character varying(255),
timeout integer,
ffmpeg_cmd_key character varying(255),
rtsp_type character varying(50),
media_server_id character varying(50),
enable_audio bool default false,
enable_mp4 bool default false,
pulling bool default false,
enable bool default false,
enable_remove_none_reader bool default false,
create_time character varying(50),
name character varying(255),
update_time character varying(50),
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
stream character varying(255),
create_time character varying(50),
media_server_id character varying(50),
server_id character varying(50),
push_time character varying(50),
status bool default false,
update_time character varying(50),
pushing bool default false,
self bool default false,
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
alter table wvp_cloud_record add column if not exists server_id character varying(50);
ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path;
alter table wvp_cloud_record alter folder type varchar(500);
alter table wvp_cloud_record alter file_path type varchar(500);
update wvp_cloud_record set server_id = '你的服务ID';

View File

@@ -1,63 +1,105 @@
/*
* 20240528
*/
ALTER TABLE wvp_media_server ADD COLUMN IF NOT EXISTS transcode_suffix character varying(255);
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS type character varying(50) default 'zlm';
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_ssl_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_ssl_port integer;
create table IF NOT EXISTS 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)
);
/*
* 20241222
*/
ALTER TABLE wvp_device_channel drop CONSTRAINT IF EXISTS uk_wvp_device_channel_unique_device_channel;
ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_push_id;
ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_proxy_id;
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_type integer not null;
ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_device_id integer not null;
alter table wvp_device_channel
add data_type integer not null;
DO $$
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id')
THEN
update wvp_device_channel wdc set data_type = 1, data_device_id =
(SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id )
where device_db_id is not null;
END IF;
alter table wvp_device_channel
add data_device_id integer not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id')
THEN
update wvp_device_channel wdc set data_type = 2, data_device_id =
(SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id )
where stream_push_id is not null;
END IF;
update wvp_device_channel wdc
set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id')
THEN
update wvp_device_channel wdc set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id )
where stream_proxy_id is not null;
END IF;
END $$;
update wvp_device_channel wdc
set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null;
update wvp_device_channel wdc
set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;
alter table wvp_device_channel drop column IF EXISTS device_db_id;
alter table wvp_device_channel drop column IF EXISTS stream_push_id;
alter table wvp_device_channel drop column IF EXISTS stream_proxy_id;
/*
* 20241231
*/
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
alter table wvp_stream_proxy add column IF NOT EXISTS relates_media_server_id character varying(50);
/*
* 20250111
*/
drop index uk_stream_push_app_stream_path on wvp_cloud_record;
alter table wvp_cloud_record change folder folder varchar(500) null;
alter table wvp_cloud_record change file_path file_path varchar(500) null;
ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path;
alter table wvp_cloud_record alter folder type varchar(500);
alter table wvp_cloud_record alter file_path type varchar(500);
/*
* 20250211
*/
alter table wvp_device change keepalive_interval_time heart_beat_interval integer;
alter table wvp_device add heart_beat_count integer;
alter table wvp_device add position_capability integer;
alter table wvp_device rename keepalive_interval_time to heart_beat_interval;
alter table wvp_device add column if not exists heart_beat_count integer;
alter table wvp_device add column if not exists position_capability integer;
/**
* 20250312
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
alter table wvp_device add column if not exists server_id character varying(50);
alter table wvp_media_server add column if not exists server_id character varying(50);
alter table wvp_stream_proxy add column if not exists server_id character varying(50);
alter table wvp_cloud_record add column if not exists server_id character varying(50);
alter table wvp_platform add column if not exists server_id character varying(50);
update wvp_device set server_id = '你的服务ID';
update wvp_media_server set server_id = '你的服务ID';
update wvp_stream_proxy set server_id = '你的服务ID';
update wvp_cloud_record set server_id = '你的服务ID';
/*
* 20250319
*/
alter table wvp_device_channel add column if not exists gps_speed double precision;
alter table wvp_device_channel add column if not exists gps_altitude double precision;
alter table wvp_device_channel add column if not exists gps_direction double precision;
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";