/*
 change.sql 说明
 1.数据库相关修改添加到对应的 change.sql 文件，无需调整其他 sql  文件
 2.sql 语句验证正确后再提交
*/
-- 2022-8-3 liangjc PORTAL_SYS_MENU 增加菜单类型
ALTER TABLE PORTAL_SYS_MENU ADD TYPE_ VARCHAR(50) comment '菜单类型';

-- 2022-08-08 yujl 增加account账号字段
ALTER TABLE portal_biz_system_auth ADD COLUMN `account_` varchar(64) COMMENT '账号';

-- 2022-08-12 yijj 修改form_data_template的 SUB_FIELD_ 字段类型为longtext
ALTER TABLE form_data_template MODIFY COLUMN `SUB_FIELD_` longtext NULL COMMENT '子表字段' AFTER `AFTER_FCRIPT_`;

-- liangjc 2022-8-12 修改字段长度
alter table FORM_META modify NAME_ VARCHAR(150);
alter table FORM_PRINT_TEMPLATE modify FILE_NAME VARCHAR(150);
alter table PORTAL_SYS_MENU modify NAME_ VARCHAR(150);
alter table portal_sys_logs_settings modify REMARK_ VARCHAR(1000);
alter table UC_ROLE modify DESCRIPTION_ VARCHAR(150);
alter table PORTAL_SERVICE_CHOREOGRAPHY modify NAME_ VARCHAR(150);
alter table PORTAL_INTERFACE_MANAGER modify NAME_ VARCHAR(150);
alter table PORTAL_CONNECTION_MANAGER modify NAME_ VARCHAR(150);
alter table PORTAL_SYS_DATASOURCE modify NAME_ VARCHAR(150);
alter table FORM_CUSTOM_CHART modify NAME_ VARCHAR(150);
alter table PORTAL_SYS_APP modify NAME_ VARCHAR(150);
alter table PORTAL_SYS_APP modify DESC_ VARCHAR(1000);
alter table PORTAL_BIZ_SYSTEM modify SYS_CODE_ VARCHAR(150);
alter table PORTAL_BIZ_SYSTEM modify SYS_NAME_ VARCHAR(150);
alter table PORTAL_BIZ_SYSTEM modify ROOT_ADDRESS_ VARCHAR(1000);
alter table PORTAL_BIZ_SYSTEM modify HOME_ADDRESS_ VARCHAR(1000);
alter table PORTAL_BIZ_SYSTEM modify BPM_MSG_QUEUE_ VARCHAR(150);
alter table PORTAL_SYS_MODULE modify NAME_ VARCHAR(150);
alter table PORTAL_SYS_MODULE modify CODE_ VARCHAR(150);
alter table PORTAL_SYS_PROPERTIES modify NAME VARCHAR(150);
alter table PORTAL_SYS_PROPERTIES modify ALIAS VARCHAR(150);
alter table PORTAL_SYS_PROPERTIES modify GROUP_ VARCHAR(150);
alter table PORTAL_SYS_PROPERTIES modify DESCRIPTION VARCHAR(1000);
alter table UC_ROLE modify NAME_ VARCHAR(150);
alter table UC_TENANT_MANAGE modify NAME_ VARCHAR(300);
alter table UC_TENANT_MANAGE modify NAME_FRONT_ VARCHAR(300);
alter table UC_TENANT_MANAGE modify SHORTHAND_ VARCHAR(150);
alter table BPM_AGENT_SETTING modify SUBJECT_ VARCHAR(150);
alter table FORM_BO_DEF modify DESCRIPTION_ VARCHAR(150);
alter table PORTAL_SYS_MSG_TPL modify KEY_ VARCHAR(150);
alter table PORTAL_SYS_MSG_TPL modify SMS_TEMPLATE_NO_ VARCHAR(150);
alter table PORTAL_SYS_MSG_TPL modify VOICE_TEMPLATE_NO_ VARCHAR(150);
alter table PORTAL_SYS_MSG_TPL modify SUBJECT_ VARCHAR(1000);
alter table BPM_MULTI_SCRIPT modify METHOD_DESC_ VARCHAR(1000);
alter table BPM_SCRIPT modify NAME_ VARCHAR(150);
alter table BPM_SCRIPT modify MEMO_ VARCHAR(1000);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify NAME_ VARCHAR(150);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify LOCATION_ VARCHAR(300);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify FTP_URL_ VARCHAR(300);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify FTP_PORT_ VARCHAR(300);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify FTP_USER_NAME_ VARCHAR(150);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify FTP_PASSWORD_ VARCHAR(150);
alter table PORTAL_FLOW_UPLOAD_PROPERTIES modify DESC_ VARCHAR(1000);
alter table PORTAL_BIZ_SYSTEM_AUTH modify SYS_NAME_ VARCHAR(150);

-- yijj 修改菜单旧数据
UPDATE PORTAL_SYS_MENU
SET TYPE_ = 'catalog'
WHERE
	ID_ IN ( SELECT t.id_ FROM ( SELECT id_ FROM PORTAL_SYS_MENU WHERE ROUTE_EXTEND_ LIKE '%"MultilevelMenuLayout%' OR ROUTE_EXTEND_ LIKE '%"Layout%' OR ROUTE_EXTEND_ IS NULL ) t );
UPDATE PORTAL_SYS_MENU
SET type_ = 'page'
WHERE
	id_ NOT IN ( SELECT t.id_ FROM ( SELECT id_ FROM PORTAL_SYS_MENU WHERE ROUTE_EXTEND_ LIKE '%"MultilevelMenuLayout%' OR ROUTE_EXTEND_ LIKE '%"Layout%' OR ROUTE_EXTEND_ IS NULL ) t );
