From 3ea236efdd6aaba11d53268333633c4c12911dfb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 27 Dec 2024 10:07:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 1 - 数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 1 - 数据库/2.7.3/更新-mysql-2.7.3.sql | 12 +++++++++--- 数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql | 7 +++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index 09257ebd..17a73f32 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -149,7 +149,6 @@ create table wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, - constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index 49d18d07..5a2b7fc8 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -165,7 +165,6 @@ create table wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, - constraint uk_wvp_device_channel_unique_data unique (data_type, data_device_id), constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql index fa288fbc..6d40353a 100644 --- a/数据库/2.7.3/更新-mysql-2.7.3.sql +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -1,6 +1,12 @@ /* * 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; alter table wvp_device_channel add data_type integer not null; @@ -9,15 +15,15 @@ alter table wvp_device_channel add data_device_id integer not null; 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 + (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; 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 + (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; 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 + (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 device_db_id; diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql index c8b7d59a..a330045b 100644 --- a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -2,6 +2,13 @@ * 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; + alter table wvp_device_channel add data_type integer not null;