From c81cbaf07f5f297bd3ecea3e0349255ac640a728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=B3=E9=A9=B9=20=E4=B8=87?= Date: Tue, 18 Apr 2023 14:41:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81gbSip=E7=BA=A7=E8=81=94?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=9C=AC=E5=9C=B0=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/mysql/docker_mysql_create_table.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/script/mysql/docker_mysql_create_table.sh b/script/mysql/docker_mysql_create_table.sh index 7be9871..18485c3 100644 --- a/script/mysql/docker_mysql_create_table.sh +++ b/script/mysql/docker_mysql_create_table.sh @@ -184,6 +184,7 @@ CREATE TABLE IF NOT EXISTS T_SuperiorInfo ( ServerPort int(11) NOT NULL COMMENT '上级端口', ClientID varchar(50) NOT NULL COMMENT '本地SIP国标编码', ClientName varchar(50) NOT NULL COMMENT '本地SIP名称', + ClientPort int(11) NOT NULL DEFAULT 0 COMMENT '本地端口', SIPUsername varchar(50) NOT NULL COMMENT 'SIP认证用户名', SIPPassword varchar(50) NOT NULL COMMENT 'SIP认证密码', Expiry int(11) NOT NULL COMMENT '注册有效期', @@ -215,4 +216,22 @@ CREATE TABLE IF NOT EXISTS T_UserInfo ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; " -mysql -u$mysql_root_user_name -p$mysql_root_user_pwd -P$mysql_port -e"$sql_create_table" \ No newline at end of file +mysql -u$mysql_root_user_name -p$mysql_root_user_pwd -P$mysql_port -e"$sql_create_table" + + + +###########修改表结构,插入列############2023.4.18 +echo "检查gbs 230418更新...." +sql_columns_is_exits="USE $mysql_gbs_dbname; +select 1 from information_schema.columns where table_name='T_SuperiorInfo' and column_name = 'ClientPort';" +host=$(mysql -u$mysql_root_user_name -p$mysql_root_user_pwd -P$mysql_port -e"$sql_columns_is_exits") +if [ ! -n "$host" ] ;then + echo "插入列" + sql_columns_insert="USE $mysql_gbs_dbname; + ALTER TABLE T_SuperiorInfo + ADD COLUMN ClientPort int(11) NOT NULL DEFAULT 0 COMMENT '本地端口' AFTER ClientName;" + mysql -u$mysql_root_user_name -p$mysql_root_user_pwd -P$mysql_port -e"$sql_columns_insert" +else + echo "列已存在" +fi +########################################## \ No newline at end of file