/*
 change.sql 说明
 1.数据库相关修改添加到对应的 change.sql 文件，无需调整其他 sql  文件
 2.sql 语句验证正确后再提交
*/

-- 2022-11-25 栏目表增加css样式字段
ALTER TABLE portal_sys_column ADD STYLE_ text default null COMMENT 'css样式';
-- 外部系统管理增加配置认证接口 update by ouyanggaolong20221111
ALTER TABLE `portal_biz_system`
ADD COLUMN `TOKEN_TYPE_` tinyint DEFAULT 0 COMMENT '票据入参方式，0-头部参数；1-url参数';
ALTER TABLE `portal_biz_system`
ADD COLUMN `TOKEN_KEY_` varchar(128) DEFAULT NULL COMMENT '票据入参KEY';
ALTER TABLE `portal_biz_system`
ADD COLUMN `TOKEN_EXPIRE_` int DEFAULT 3600 COMMENT '票据过期时间，单位秒';
ALTER TABLE `portal_biz_system`
ADD COLUMN `TOKEN_API_INFO` text DEFAULT NULL COMMENT '认证接口信息Json';
-- 接口管理增加来源类型 update by ouyanggaolong20221115
ALTER TABLE `portal_interface_manager`
ADD COLUMN `SOURCE_TYPE_` int DEFAULT 0 COMMENT '接口来源，0-连接；1-服务';
-- 增加初始化连接标志 update by ouyanggaolong20221128
ALTER TABLE `portal_connection_manager`
ADD COLUMN `INIT_FLAG_` tinyint DEFAULT 0 COMMENT '是否初始化数据，0或null-否；1-是';
-- 关联查询增加集成管理接口别名 update by ouyanggaolong20221129
ALTER TABLE `form_custom_query`
ADD COLUMN `API_ALIAS_` varchar(64) DEFAULT NULL COMMENT '集成管理接口别名';
-- 对话框增加集成管理接口别名 update by ouyanggaolong20221202
ALTER TABLE `form_custom_dialog`
ADD COLUMN `API_ALIAS_` varchar(64) DEFAULT NULL COMMENT '集成管理接口别名';

-- 2022-12-14 liangjc 迁移流程推演-增加表
CREATE TABLE `bpm_node_setting`  (
  `ID_` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键',
  `CREATE_BY_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人ID',
  `CREATE_TIME_` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `CREATE_ORG_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者所属组织ID',
  `UPDATE_BY_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人ID',
  `UPDATE_TIME_` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `TENANT_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
  `NODE_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '节点id',
  `DEF_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程定义id',
  `FORECAST_` int(0) NULL DEFAULT NULL COMMENT '审批预测值(1为同意,2为反对,默认为1)',
  PRIMARY KEY (`ID_`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '流程定义节点设置表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

-- 2022-12-14 liangjc 审批历史表增加字段
ALTER TABLE `bpm_check_opinion`
ADD COLUMN `VARS_` longtext NULL COMMENT '流程变量' ;

-- url菜单增加配置认证接口 update by ouyanggaolong20221223
ALTER TABLE `portal_sys_menu`
ADD COLUMN `token_Enabled_` tinyint DEFAULT 0 COMMENT '是否追加token，0-否；1-是';
ALTER TABLE `portal_sys_menu`
ADD COLUMN `TOKEN_TYPE_` tinyint DEFAULT 0 COMMENT '获取模式，0-当前用户；1-接口获取';
ALTER TABLE `portal_sys_menu`
ADD COLUMN `TOKEN_KEY_` varchar(128) DEFAULT NULL COMMENT '票据入参KEY';
ALTER TABLE `portal_sys_menu`
ADD COLUMN `TOKEN_API_` text DEFAULT NULL COMMENT '认证接口信息Json，base64编码';

-- 2022-11-30 liangjc 用户自定义待办事项表增加收藏列表排序 和 租户id字段
ALTER TABLE portal_custom_todo ADD MARK_SN_ int default null COMMENT '收藏列表排序字段';
ALTER TABLE portal_custom_todo ADD TENANT_ID_ varchar(64) DEFAULT NULL;

-- 2022-12-29 修改任务名称长度
alter table bpm_task  modify NAME_ varchar(100) not null comment '任务名称';

-- 2022-12-30 增加diy组件表
CREATE TABLE FORM_CUSTOM_COMPONENT (
  ID_ VARCHAR(255),
  NAME_ VARCHAR(255),
  ALIAS_ VARCHAR(255),
  TENANT_ID_ VARCHAR(255),
  CREATE_BY_ VARCHAR(255),
  UPDATE_BY_ VARCHAR(255),
  CREATE_ORG_ID_ VARCHAR(255),
  CREATE_TIME_ DATE,
  UPDATE_TIME_ DATE,
  TEMPLATE_ longtext,
  JS_CODE_ longtext,
  DATA_CODE_ longtext
);

--  2022-12-30 增加diy组件菜单
INSERT INTO PORTAL_SYS_MENU (ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1550294793437974528', '3631013', 'DIY组件', 'formCustomComponentManager', NULL, NULL, NULL, '1', NULL, '-1.1.3441002.3631013.1550294793437974528.', NULL, '-1');

-- 2022-12-30 liangjc 迁移待办中心
ALTER TABLE `bpm_check_opinion`
    ADD COLUMN `QUALFIEDS_ACCOUNT_` text NULL COMMENT '有审批资格用户帐号串' AFTER `TENANT_ID_`,
ADD COLUMN `AUDITOR_ACCOUNT_` varchar(255) NULL COMMENT '实际审判人' AFTER `qualfieds_account_`;

CREATE TABLE `bpm_flow_mq_log` (
`ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键',
`TYPE_` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型',
`TITLE_` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '标题',
`CONTENT_` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '内容',
`STATUS_` int NOT NULL COMMENT '状态',
`TRY_TIME_` int DEFAULT NULL COMMENT '重试次数',
`EXCEPTION_` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '异常信息',
`LOG_TIME_` datetime DEFAULT NULL COMMENT '日志记录时间',
`TARGET_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志目标类型',
`PROC_INST_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '实例ID',
`TASK_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务ID',
`OWNER_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务所属人id',
`OWNER_NAME_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务所属人姓名',
`TENANT_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '租户id',
`YEARS_PARTITION_` int DEFAULT NULL COMMENT '日志所属年份',
PRIMARY KEY (`ID_`) USING BTREE,
KEY `IDX_YEARS_PARTITION_` (`YEARS_PARTITION_`) USING BTREE,
KEY `IDX_PROC_INST_ID_` (`PROC_INST_ID_`) USING BTREE,
KEY `idx_bpm_flow_message_type` (`TYPE_`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '统一待办推送日志' ROW_FORMAT=DYNAMIC;

-- 2023-1-3 jjx  更新移动端待办列表配置
UPDATE `portal_sys_column` SET  `TEMPLATE_HTML` = 'PGRpdj4KICA8ZGl2ICBjbGFzcz0idG9kby1oZWFkZXIiIHN0eWxlPSJkaXNwbGF5OmZsZXg7anVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO2hlaWdodDogMS4wNjY3cmVtO2FsaWduLWl0ZW1zOiBjZW50ZXI7cGFkZGluZzowIDAuMzJyZW07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JFJyB8fCByb3cuc3RhdHVzID09ICdCQUNLU0hBUkUnKSB7CiAgICAgICAgICAgIGlmIChyb3cuaWRlbnRpdHlMaXN0ICYmIHJvdy5pZGVudGl0eUxpc3QubGVuZ3RoID09IDEpIHsKICAgICAgICAgICAgICB0aGlzLiRyb3V0ZXIucHVzaCgKICAgICAgICAgICAgICAgICcvdGFzay8nICsgcm93LmlkICsgJy8nICsgcm93LmlkZW50aXR5TGlzdFswXS5pZAogICAgICAgICAgICAgICkKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBsZXQgaHRtbCA9CiAgICAgICAgICAgICAgICAnPHNlbGVjdCByZWY9JyArCiAgICAgICAgICAgICAgICBNYXRoLnJhbmRvbSgpICsKICAgICAgICAgICAgICAgICcgaWQ9ImFwcHJvdmFsTGVhZGVyU2VsZWN0IiBzdHlsZT0id2lkdGg6IDIwMHB4O2hlaWdodDogMzBweDtib3JkZXItcmFkaXVzOiA0cHg7bWFyZ2luOiAyMHB4IDcwcHg7IiA+PG9wdGlvbiB2YWx1ZT0iIj7or7fpgInmi6k8L29wdGlvbj4nCiAgICAgICAgICAgICAgcm93LmlkZW50aXR5TGlzdC5mb3JFYWNoKChpZGVudGl0eSkgPT4gewogICAgICAgICAgICAgICAgaHRtbCArPQogICAgICAgICAgICAgICAgICAnPG9wdGlvbiB2YWx1ZT0iJyArCiAgICAgICAgICAgICAgICAgIGlkZW50aXR5LmlkICsKICAgICAgICAgICAgICAgICAgJyI+JyArCiAgICAgICAgICAgICAgICAgIGlkZW50aXR5Lm5hbWUgKwogICAgICAgICAgICAgICAgICAnPC9vcHRpb24+JwogICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgaHRtbCArPSAnPC9zZWxlY3Q+JwogICAgICAgICAgICAgIGxldCB0aGlzXyA9IHRoaXMKICAgICAgICAgICAgICB0aGlzLiRhbGVydChodG1sLCAn6K+36YCJ5oup5LiA5Liq6aKG5a+85Luj5Li65a6h5om5JywgewogICAgICAgICAgICAgICAgZGFuZ2Vyb3VzbHlVc2VIVE1MU3RyaW5nOiB0cnVlLAogICAgICAgICAgICAgICAgYmVmb3JlQ2xvc2U6IGZ1bmN0aW9uIChhY3Rpb24sIGluc3RhbmNlLCBkb25lKSB7CiAgICAgICAgICAgICAgICAgIGlmIChhY3Rpb24gPT0gJ2NvbmZpcm0nKSB7CiAgICAgICAgICAgICAgICAgICAgbGV0IHNlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2FwcHJvdmFsTGVhZGVyU2VsZWN0JykKICAgICAgICAgICAgICAgICAgICBpZiAoc2Uuc2VsZWN0ZWRJbmRleCA9PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBOb3RpZnkoewogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnd2FybmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICfor7fpgInmi6nku6PkuLrlrqHmibnnmoTpooblr7wnLAogICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2UuY2xvc2UoKQogICAgICAgICAgICAgICAgICAgICAgdGhpc18uJHJvdXRlci5wdXNoKAogICAgICAgICAgICAgICAgICAgICAgICAnL3Rhc2svJyArIHJvdy5pZCArICcvJyArIHNlW3NlLnNlbGVjdGVkSW5kZXhdLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGluc3RhbmNlLmNsb3NlKCkKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICB9KQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKAogICAgICAgICAgICByb3cuc3RhdHVzID09ICdBR0VOVCcgJiYKICAgICAgICAgICAgcm93Lm93bmVySWQgIT0gcm93LmFzc2lnbmVlSWQgJiYKICAgICAgICAgICAgcm93Lm93bmVySWQgPT0gdGhpcy4kc3RvcmUuc3RhdGUubG9naW4uY3VycmVudFVzZXIudXNlcklkCiAgICAgICAgICApIHsKICAgICAgICAgICAgLy/lp5TmiZjku7vliqEKICAgICAgICAgICAgdGhpcy4kcm91dGVyLnB1c2goJy9pbnN0UmVhZC8nICsgcm93LnByb2NJbnN0SWQgKyAnL2FnZW50JykKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMuJHJvdXRlci5wdXNoKCcvdGFzay8nICsgcm93LmlkICsgJy8wJykKICAgICAgICAgIH0KICAgICAgIH0sCiAgICAgIGZpbHRlckRhdGUoZGF0ZSkgewogICAgICAgIHZhciBjdXJyZW50RGF0ZSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpCiAgICAgICAgZGF0ZSA9IG5ldyBEYXRlKGRhdGUucmVwbGFjZSgvLS9nLCAnLycpKS5nZXRUaW1lKCkKICAgICAgICBpZiAoZGF0ZSAhPSB1bmRlZmluZWQpIHsKICAgICAgICAgIHZhciB0b3RhbCA9IChjdXJyZW50RGF0ZSAtIGRhdGUpIC8gMTAwMAogICAgICAgICAgdmFyIGRheSA9IHBhcnNlSW50KHRvdGFsIC8gKDI0ICogNjAgKiA2MCkpIC8v6K6h566X5pW05pWw5aSp5pWwCiAgICAgICAgICB2YXIgYWZ0ZXJEYXkgPSB0b3RhbCAtIGRheSAqIDI0ICogNjAgKiA2MCAvL+WPluW+l+eul+WHuuWkqeaVsOWQjuWJqeS9meeahOenkuaVsAogICAgICAgICAgdmFyIGhvdXIgPSBwYXJzZUludChhZnRlckRheSAvICg2MCAqIDYwKSkgLy/orqHnrpfmlbTmlbDlsI/ml7bmlbAKICAgICAgICAgIHZhciBhZnRlckhvdXIgPSB0b3RhbCAtIGRheSAqIDI0ICogNjAgKiA2MCAtIGhvdXIgKiA2MCAqIDYwIC8v5Y+W5b6X566X5Ye65bCP5pe25pWw5ZCO5Ymp5L2Z55qE56eS5pWwCiAgICAgICAgICB2YXIgbWluID0gcGFyc2VJbnQoYWZ0ZXJIb3VyIC8gNjApIC8v6K6h566X5pW05pWw5YiGCiAgICAgICAgICB2YXIgYWZ0ZXJNaW4gPSBwYXJzZUludCgKICAgICAgICAgICAgdG90YWwgLSBkYXkgKiAyNCAqIDYwICogNjAgLSBob3VyICogNjAgKiA2MCAtIG1pbiAqIDYwIC8v5Y+W5b6X566X5Ye65YiG5ZCO5Ymp5L2Z55qE56eS5pWwCiAgICAgICAgICApCiAgICAgICAgICB2YXIgdmFsID0gJycKICAgICAgICAgIGlmIChkYXkgIT0gMCkgewogICAgICAgICAgICByZXR1cm4gKHZhbCArPSBkYXkgKyAnZCcpCiAgICAgICAgICB9IGVsc2UgaWYgKGhvdXIgIT0gMCkgewogICAgICAgICAgICByZXR1cm4gKHZhbCArPSBob3VyICsgJ2gnKQogICAgICAgICAgfSBlbHNlIGlmIChtaW4gIT0gMCkgewogICAgICAgICAgICByZXR1cm4gKHZhbCArPSBtaW4gKyAnbScpCiAgICAgICAgICB9IGVsc2UgaWYgKGFmdGVyTWluICE9IDApIHsKICAgICAgICAgICAgcmV0dXJuICh2YWwgKz0gYWZ0ZXJNaW4gKyAncycpCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9LAogICAgfSwKICAgIAp9' WHERE `ALIAS` = 'wddbmobile';


-- UDS同步记录表 update by ouyanggaolong20221229
CREATE TABLE `uc_batch_sync` (
  `ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `EXECUTE_TIME_` datetime DEFAULT NULL COMMENT '当前时间点',
  `DATA_IDS_` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '同步数据ID，json格式；调用函数名和入参。',
	`STATUS_` smallint DEFAULT 0 COMMENT '状态，0-正在同步；1-已提交；2-已回滚',
	`CREATE_TIME_` datetime DEFAULT NULL COMMENT '创建时间',
	`UPDATE_TIME_` datetime DEFAULT NULL COMMENT '更新时间',
	`CREATE_BY_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建人用户ID',
  `CREATE_ORG_ID_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建人组织ID',
  `UPDATE_BY_` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '更新人用户ID',
  PRIMARY KEY (`ID_`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='UDS同步记录表';
ALTER TABLE uc_org_job DROP INDEX `IDX_JOB_CODE_UNQ`;
ALTER TABLE uc_org_job ADD UNIQUE KEY `IDX_JOB_CODE_UNQ` (`CODE_`,`TENANT_ID_`,`IS_DELE_`) USING BTREE;

-- 2023年1月4日 huangtp 门户管理表新增管理员id、管理员名称字段
alter table portal_sys_layout_manage
    add MANAGER_ID_ varchar(32) null comment '管理员id';

alter table portal_sys_layout_manage
    add MANAGER_NAME_ varchar(32) null comment '管理员名称';

-- 2023年1月5日 huangtp 修改【栏目管理】数据参数字段范围加大
alter table portal_sys_column
    modify DATA_PARAM longtext null;

-- 增加扩展jar包类型 update by 欧阳高龙 20230109
alter table bpm_extend_jar
    add `TYPE_` int DEFAULT '0' COMMENT 'jar包类型。0：script脚本扩展，1：用户数据同步';


--   修改div组件表 创建，修改时间类型 update by 刘汉广 2023/1/10
ALTER TABLE `form_custom_component`
MODIFY COLUMN `CREATE_TIME_` datetime(0) NULL DEFAULT NULL AFTER `CREATE_ORG_ID_`,
MODIFY COLUMN `UPDATE_TIME_` datetime(0) NULL DEFAULT NULL AFTER `CREATE_TIME_`;

-- 2022-1-11 liangjc 修改pc模块菜单别名
update portal_sys_menu set ALIAS_ = 'pcModel' WHERE id_='1296282423985836032';

-- uc_org、uc_org_post和uc_role唯一索引增加删除标志 update by 欧阳高龙20230111
ALTER TABLE uc_org DROP INDEX `IDX_ORG_CODE_UNQ`;
ALTER TABLE uc_org ADD UNIQUE KEY `IDX_ORG_CODE_UNQ` (`CODE_`,`TENANT_ID_`,`IS_DELE_`) USING BTREE;
ALTER TABLE uc_org_post DROP INDEX `IDX_POST_CODE_UNQ`;
ALTER TABLE uc_org_post ADD UNIQUE KEY `IDX_POST_CODE_UNQ` (`CODE_`,`TENANT_ID_`,`IS_DELE_`) USING BTREE;
ALTER TABLE uc_role DROP INDEX `IDX_ROLE_CODE`;
ALTER TABLE uc_role ADD UNIQUE KEY `IDX_ROLE_CODE` (`CODE_`,`TENANT_ID_`,`IS_DELE_`) USING BTREE;
-- 增加用户数据同步定时任务 update by 欧阳高龙20230111
insert into qrtz_job_details VALUES(
'quartzScheduler', '用户数据同步', '-1', '用户数据同步定时任务，结合外部扩展jar包上传', 'com.hotent.job.job.UserSyncJob', '1', '1', '0', '0',null);

--  修改参数表JSON字段长度 update by 刘汉广 2023/1/10
ALTER TABLE `uc_params`
MODIFY COLUMN `JSON_` varchar(1700) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'json值' AFTER `CTL_TYPE_`;

-- 2022-1-11 liangjc 增加关系矩阵管理员表
CREATE TABLE uc_matrix_auth  (
  ID_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  MATRIX_ID_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci  DEFAULT NULL COMMENT '关系矩阵id',
  USER_ID_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '管理员id',
  CREATE_TIME_ datetime(0) DEFAULT NULL,
  CREATE_BY_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  UPDATE_TIME_ datetime(0) DEFAULT NULL,
  UPDATE_BY_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  PRIMARY KEY (ID_) USING BTREE,
  INDEX IDX_MATRIX_AUTH_USERID(USER_ID_) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '关系矩阵管理员' ROW_FORMAT = DYNAMIC;

-- 2022-1-31 liangjc 表单修改记录增加bo别名字段
alter table bpm_form_modify_record
    add BO_ALIAS_ varchar(64) null comment 'bo别名' after REASON_;

-- 2023-02-03 huangtp 新增门户管理授权表
create table portal_sys_layout_auth
(
    ID_          varchar(64) not null,
    LAYOUT_ID_   varchar(64) null comment '门户id',
    USER_ID_     varchar(64) null comment '管理员id',
    CREATE_TIME_ datetime    null,
    CREATE_BY_   varchar(64) null,
    UPDATE_TIME_ datetime    null,
    UPDATE_BY_   varchar(64) null,
    TENANT_ID_   varchar(32) default '-1' null,
    constraint portal_sys_layout_auth_pk
        primary key (ID_)
);
ALTER TABLE `portal_sys_layout_auth` COMMENT = '门户管理授权表';

-- 2023-02-04 huangtp 新增门户管理授权表用户名称、用户账号字段
alter table portal_sys_layout_auth
    add user_name_ varchar(64) null comment '用户名称' after USER_ID_;
alter table portal_sys_layout_auth
    add account_ varchar(64) null comment '用户账号' after user_name_;

-- 2023-2-6 liangjc 门户，新闻公告，栏目初始化栏目的权限为所有人
INSERT INTO portal_sys_auth_user ( ID_, AUTHORIZE_ID_, RIGHT_TYPE_, OBJ_TYPE_, TENANT_ID_ )
SELECT
	id,
	id,
	'everyone',
	'layoutManage',
	TENANT_ID_
FROM
	portal_sys_layout_manage
WHERE
	ID NOT IN ( SELECT AUTHORIZE_ID_ FROM portal_sys_auth_user )
	AND ID NOT IN ( SELECT id_ FROM portal_sys_auth_user );	
	
	
INSERT INTO portal_sys_auth_user ( ID_, AUTHORIZE_ID_, RIGHT_TYPE_, OBJ_TYPE_, TENANT_ID_ )
SELECT
	id_,
	id_,
	'everyone',
	'newsNotice',
	TENANT_ID_
FROM
	PORTAL_NEWS_NOTICE_
WHERE
	ID_ NOT IN ( SELECT AUTHORIZE_ID_ FROM portal_sys_auth_user )
	AND ID_ NOT IN ( SELECT id_ FROM portal_sys_auth_user );	
	
INSERT INTO portal_sys_auth_user ( ID_, AUTHORIZE_ID_, RIGHT_TYPE_, OBJ_TYPE_, TENANT_ID_ )
SELECT
	ID,
	ID,
	'everyone',
	'indexColumn',
	TENANT_ID_
FROM
	portal_sys_column
WHERE
	ID NOT IN ( SELECT AUTHORIZE_ID_ FROM portal_sys_auth_user )
	AND ID NOT IN ( SELECT id_ FROM portal_sys_auth_user );

-- 2023-2-8 liangjc 会议室配置表增加版本号字段
ALTER TABLE portal_meeting_config ADD COLUMN version_ int  COMMENT '版本号';
update portal_meeting_config set version_=1 where version_ is null;

-- 2023-02-13 huangtp 关系矩阵授权表加上用户账号
alter table uc_matrix_auth
    add ACCOUNT_ varchar(32) not null comment '用户账号' after USER_ID_;

-- (接口授权菜单目录调整)更新服务管理菜单、接口授权标签页；增加外部系统管理标签页 update by ouyanggaolong 20230215
UPDATE `portal_sys_menu` SET ACTIVE_TAB_='bizSystemManager' where ID_='1437738312683724800';
UPDATE `portal_sys_menu` SET PARENT_ID_='1437738312683724800',
PATH_='-1.1.1437982148582154240.1437738312683724800.1451456425861406720.',
SN_=2,
TYPE_='catalog'
where ID_='1451456425861406720';
INSERT INTO `portal_sys_menu`(`ID_`, `PARENT_ID_`, `NAME_`, `ALIAS_`, `ACTIVE_TAB_`, `MENU_ICON_`, `OPENED_`, `SN_`, `TABS_STYLE_`, `PATH_`, `HREF_`, `TENANT_ID_`, `ROUTE_EXTEND_`, `TYPE_`, `IS_REFRESH_`, `token_Enabled_`, `TOKEN_TYPE_`, `TOKEN_KEY_`, `TOKEN_API_`)
VALUES ('1625684930068721664', '1437738312683724800', '外部系统管理', 'bizSystemManager', '', '', NULL, 1, '', '-1.1.1437982148582154240.1437738312683724800.1625684930068721664.', '', '-1', '', 'catalog', 1, 0, 0, NULL, NULL);


-- 2023-02-15 liangjc 栏目表增加是否初始化栏目标识
alter table portal_sys_column add is_init_ SMALLINT null comment '是否初始化栏目（新增租户给租户初始化）';
update portal_sys_column set is_init_=1 where TENANT_ID_ = -1;

UPDATE PORTA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mc6ttrqa99d+/rA18IKaxcE1ERlK4A3vMjTreiu/eeqaSI3PHJrupfaZLP9BcvyGZaK54FZTLZKrjkJ4DjsGPMG0HCW/5zl801p+af8b6Sh7IQkaY67Jnd2cPH9CeB4+bIcJ77yUxR8RVnKjNsgHwMzxjUDjXjruC1tssi/8' WHERE ALIAS = 'taskListFiledConf';

INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1628285933335953408', 'en', 'eip.common.import', 'import',  '1', NULL, NULL, NULL, '-1');

INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1628285933373702144', 'zh-TW', 'eip.common.import', '導入',  '1', NULL, NULL, NULL, '-1');

INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_)VALUES ('1628285933411450880', 'zh-CN', 'eip.common.import', '导入',  '1', NULL, NULL, NULL, '-1');
INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1628286057118253056', 'en', 'eip.common.export', 'export',  '1', NULL, NULL, NULL, '-1');
INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_)VALUES ('1628286057156001792', 'zh-TW', 'eip.common.export', '導出',  '1', NULL, NULL, NULL, '-1');
INSERT INTO  PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1628286057189556224', 'zh-CN', 'eip.common.export', '导出', '1', NULL, NULL, NULL, '-1');

alter table portal_biz_system  add primary key (ID_);
alter table portal_biz_system_auth  add primary key (ID_);
alter table portal_msg_send_log  add primary key (ID_);
alter table portal_url_permission  add primary key (id);
alter table bpm_inst_delete_log  add primary key (ID_);
alter table form_data_template_import_log  add primary key (ID_);

-- 2023-3-6 liangjc 会议室配置默认不需要绑定流程脚本补充
update portal_meeting_config set BIND_FLOW_=0;