调整数据库结构
parent
4757cbd34e
commit
825daad355
|
@ -20,7 +20,7 @@ public class StreamProxyProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String selectForPushingInMediaServer(Map<String, Object> params ){
|
public String selectForPushingInMediaServer(Map<String, Object> params ){
|
||||||
return getBaseSelectSql() + " WHERE st.pulling=1 and st.media_server_id=#{mediaServerId} order by st.create_time desc";
|
return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String selectOneByAppAndStream(Map<String, Object> params ){
|
public String selectOneByAppAndStream(Map<String, Object> params ){
|
||||||
|
|
|
@ -70,7 +70,6 @@ create table wvp_device_mobile_position
|
||||||
create table wvp_device_channel
|
create table wvp_device_channel
|
||||||
(
|
(
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_db_id integer,
|
|
||||||
device_id character varying(50),
|
device_id character varying(50),
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
manufacturer character varying(50),
|
manufacturer character varying(50),
|
||||||
|
@ -148,16 +147,12 @@ create table wvp_device_channel
|
||||||
gb_svc_space_support_mod integer,
|
gb_svc_space_support_mod integer,
|
||||||
gb_svc_time_support_mode integer,
|
gb_svc_time_support_mode integer,
|
||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
stream_push_id integer,
|
data_type integer,
|
||||||
stream_proxy_id integer,
|
data_device_id integer,
|
||||||
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
|
constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id),
|
||||||
constraint uk_wvp_unique_channel unique (gb_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 index uk_wvp_device_db_id on wvp_device_channel (device_db_id);
|
|
||||||
|
|
||||||
create table wvp_media_server
|
create table wvp_media_server
|
||||||
(
|
(
|
||||||
id character varying(255) primary key,
|
id character varying(255) primary key,
|
||||||
|
|
|
@ -86,7 +86,6 @@ create table wvp_gb_stream
|
||||||
create table wvp_device_channel
|
create table wvp_device_channel
|
||||||
(
|
(
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
device_db_id integer,
|
|
||||||
device_id character varying(50),
|
device_id character varying(50),
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
manufacturer character varying(50),
|
manufacturer character varying(50),
|
||||||
|
@ -164,17 +163,12 @@ create table wvp_device_channel
|
||||||
gb_svc_space_support_mod integer,
|
gb_svc_space_support_mod integer,
|
||||||
gb_svc_time_support_mode integer,
|
gb_svc_time_support_mode integer,
|
||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
stream_push_id integer,
|
data_type integer,
|
||||||
stream_proxy_id integer,
|
data_device_id integer,
|
||||||
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
|
constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id),
|
||||||
constraint uk_wvp_unique_channel unique (gb_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 index uk_wvp_device_db_id on wvp_device_channel (device_db_id);
|
|
||||||
|
|
||||||
|
|
||||||
create table wvp_media_server
|
create table wvp_media_server
|
||||||
(
|
(
|
||||||
id character varying(255) primary key,
|
id character varying(255) primary key,
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* 20241222
|
||||||
|
*/
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add data_type integer;
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add data_device_id integer;
|
||||||
|
|
||||||
|
update wvp_device_channel wdc INNER JOIN
|
||||||
|
(SELECT device_db_id from wvp_device_channel where wdc.id = id and device_db_id is not null ) ct
|
||||||
|
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
|
||||||
|
|
||||||
|
update wvp_device_channel wdc INNER JOIN
|
||||||
|
(SELECT stream_push_id from wvp_device_channel where wdc.id = id and stream_push_id is not null ) ct
|
||||||
|
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
|
||||||
|
|
||||||
|
update wvp_device_channel wdc INNER JOIN
|
||||||
|
(SELECT stream_proxy_id from wvp_device_channel where wdc.id = id and stream_proxy_id is not null ) ct
|
||||||
|
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 device_db_id;
|
||||||
|
alter table wvp_device_channel drop stream_push_id;
|
||||||
|
alter table wvp_device_channel drop stream_proxy_id;
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* 20241222
|
||||||
|
*/
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add data_type integer;
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add data_device_id integer;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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 = 1, 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;
|
Loading…
Reference in New Issue