/*
 change.sql 说明
 1.数据库相关修改添加到对应的 change.sql 文件，无需调整其他 sql  文件
 2.sql 语句验证正确后再提交
*/
-- 2023-7-20 jjx 同步脚本
ALTER TABLE FORM_QUERY_SQLDEF  ADD CREATE_BY_ VARCHAR2(64);
COMMENT ON COLUMN FORM_QUERY_SQLDEF.CREATE_BY_ IS '创建人ID';

ALTER TABLE FORM_QUERY_SQLDEF ADD CREATE_TIME_ DATE;
COMMENT ON COLUMN FORM_QUERY_SQLDEF.CREATE_TIME_ IS '创建时间';

ALTER TABLE FORM_QUERY_SQLDEF ADD CREATE_ORG_ID_ VARCHAR2(64);
COMMENT ON COLUMN FORM_QUERY_SQLDEF.CREATE_ORG_ID_ IS '创建人组织ID';

ALTER TABLE FORM_QUERY_SQLDEF ADD UPDATE_BY_ VARCHAR2(64);
COMMENT ON COLUMN FORM_QUERY_SQLDEF.UPDATE_BY_ IS '更新人ID';

ALTER TABLE FORM_QUERY_SQLDEF ADD UPDATE_TIME_ DATE;
COMMENT ON COLUMN FORM_QUERY_SQLDEF.UPDATE_TIME_ IS '更新时间';


ALTER TABLE FORM_CUSTOM_CHART ADD TYPE_ SMALLINT;
COMMENT ON COLUMN FORM_CUSTOM_CHART.TYPE_ IS '''数据类型 1-数据源，2-关联查询''';

ALTER TABLE FORM_CUSTOM_CHART ADD CUSTOM_QUERY_ALIAS_ VARCHAR2(64);
COMMENT ON COLUMN FORM_CUSTOM_CHART.CUSTOM_QUERY_ALIAS_ IS '关联查询别名';


CREATE TABLE PORTAL_SYS_USER_APP (
  ID_ 			VARCHAR2(64) NOT NULL,
  TYPE_ 		VARCHAR2(10),
  APP_ALIAS_ 	VARCHAR2(255),
  ACCOUNT_ 		VARCHAR2(255),
  TENANT_ID_ 	VARCHAR2(64),
  PRIMARY KEY (ID_)
	);
COMMENT ON COLUMN PORTAL_SYS_USER_APP.TYPE_ IS '类型：PC,MOBILE';
COMMENT ON COLUMN PORTAL_SYS_USER_APP.APP_ALIAS_ IS 'APP别名';
COMMENT ON COLUMN PORTAL_SYS_USER_APP.ACCOUNT_ IS '用户ACCOUNT';
COMMENT ON TABLE PORTAL_SYS_USER_APP IS '我的应用';

 -- 2023年5月22日17:12:32 huangtp 查询日志记录的实际是日期时间格式
alter table BPM_SHOW_RECORD
    modify SHOW_TIME_ datetime;
alter table BPM_SHOW_RECORD
    modify UPDATE_TIME_ datetime;
alter table BPM_SHOW_RECORD
    modify CREATE_TIME_ datetime;
	
INSERT INTO PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1683423659722665984', 'zh-TW', 'flowButton.ProcessInfo', '流程信息', NULL, '1', '', NULL, NULL, '-1');

INSERT INTO PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1683423659747831808', 'zh-CN', 'flowButton.ProcessInfo', '流程信息', NULL, '1', '', NULL, NULL, '-1');

INSERT INTO PORTAL_I18N_MESSAGE(ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1683423659986907136', 'en', 'flowButton.ProcessInfo', 'Process Information', NULL, '1', '', NULL, NULL, '-1');	
	
ALTER TABLE PORTAL_SYS_APP ADD FILE_INFO_ VARCHAR2(1000);
COMMENT ON COLUMN PORTAL_SYS_APP.FILE_INFO_ IS '应用说明';	

ALTER TABLE PORTAL_SYS_EXTERNAL_UNITE ADD PC_BASE_URL_ VARCHAR2(255);
COMMENT ON COLUMN PORTAL_SYS_EXTERNAL_UNITE.PC_BASE_URL_ IS '本系统PC端地址';

ALTER TABLE PORTAL_SYS_EXTERNAL_UNITE ADD PC_MENU_URL_ VARCHAR2(255);
COMMENT ON COLUMN PORTAL_SYS_EXTERNAL_UNITE.PC_MENU_URL_ IS 'PC端菜单URL';

CREATE TABLE PORTAL_SYS_APP_AUTH_MENU (
  ID_ 						VARCHAR2(64) NOT NULL,
  APP_ID_				 	VARCHAR2(64),
  ROLE_ALIAS_ 		VARCHAR2(64),
  MENU_ALIAS_ 		VARCHAR2(64),
  AUTH_TYPE_ 			VARCHAR2(32),
  TENANT_ID_ 			VARCHAR2(64),
  PRIMARY KEY (ID_)
);

COMMENT ON COLUMN PORTAL_SYS_APP_AUTH_MENU.APP_ID_ IS '应用ID';

COMMENT ON COLUMN PORTAL_SYS_APP_AUTH_MENU.ROLE_ALIAS_ IS '角色别名';

COMMENT ON COLUMN PORTAL_SYS_APP_AUTH_MENU.MENU_ALIAS_ IS '菜单别名';

COMMENT ON COLUMN PORTAL_SYS_APP_AUTH_MENU.AUTH_TYPE_ IS '权限类型，增删改查等';

COMMENT ON TABLE PORTAL_SYS_APP_AUTH_MENU IS '应用菜单权限表';

CREATE INDEX IDX_AUTHUSER_AUTHID_  ON PORTAL_SYS_APP_AUTH_MENU ("ROLE_ALIAS_");

CREATE INDEX IDX_MENU_ID_ ON PORTAL_SYS_APP_AUTH_MENU ("MENU_ALIAS_");

-- 2023-08-07 jjx 同步脚本
ALTER TABLE  FORM_AUTHORIZE_ACT ADD MODEL_TYPE_ VARCHAR2(255);
COMMENT ON COLUMN  FORM_AUTHORIZE_ACT.MODEL_TYPE_ IS '授权对象类型';

ALTER TABLE  FORM_DATA_TEMPLATE ADD MOBILE_OTHER_JSON_ CLOB;
COMMENT ON COLUMN  FORM_DATA_TEMPLATE.MOBILE_OTHER_JSON_ IS '移动端扩展配置json';

-- 2023-08-08 jjx 增加传阅事项国际化配置
INSERT INTO PORTAL_I18N_MESSAGE (ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1688794655438794752', 'zh-TW', 'myReceived.circulator', '傳閲人', null, null, '', NULL, NULL, '-1');
INSERT INTO PORTAL_I18N_MESSAGE (ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1688794655455571968', 'zh-CN', 'myReceived.circulator', '传阅人', null,null, '', NULL, NULL, '-1');
INSERT INTO PORTAL_I18N_MESSAGE (ID_, TYPE_, KEY_, VALUE_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, TENANT_ID_) VALUES ('1688794655480737792', 'en', 'myReceived.circulator', 'circulator',null, null, '', NULL, NULL, '-1');

ALTER TABLE PORTAL_NEWS_NOTICE_  ADD OPEN_TYPE_ VARCHAR2(10);
COMMENT ON COLUMN PORTAL_NEWS_NOTICE_.OPEN_TYPE_ IS '打开方式';

ALTER TABLE FORM_CUSTOM_DIALOG  ADD TREE_DATA_MODE_ NUMBER(5,0);
COMMENT ON COLUMN FORM_CUSTOM_DIALOG.TREE_DATA_MODE_ IS '树形数据模式  0-默认方式，加载全部数据； 1-允许选择父级；2-不允许选择父级';

-- 2023-08-22 jjx 同步我的应用表增加栏目别名字段
ALTER TABLE PORTAL_SYS_USER_APP ADD COLUMN_ALIAS_ VARCHAR2(100) ;
COMMENT ON COLUMN PORTAL_SYS_USER_APP.COLUMN_ALIAS_ IS '栏目别名';

-- 2023-08-25 JJX 修改系统属性中的待办列表配置
UPDATE PORTAL_SYS_PROPERTIES SET VALUE = 'MvLiL4mE1+YRNj4cfPOGzXCMA5F/amaoWCA2iUnRVhcK9aZEof2/M5Ii3zWaCcQBtNG6T6/bDsspNohzSqq8MBg+UkEo+A+fojqBP9nm9s/mxAH5v+HcvPi7H00ryd0W0eMInCQ2rplU+UgHvJNr0D8+1FkL/EyQPsOG5SazUTWOWI14OS+R1tHUvVzGk6jSxrZqAz5Pi5RTNDitHrypfbF9nas8LjVzqrnYGrRimXaSaPX7zmNtlm+NoKRp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jZxYmZhHAPgQWX9n+QA7TOgCllULA2ji5pn5LXUZie3nGS9uRJ62+vq5TbmN9n0TNM9YLAI/XrDNLlAtNnY4ymy35InFrTpQQFibrbkqjmzNSEyKUD1SMvA3l8oF9xpW5+tYmZhHAPgQWX9n+QA7TOgCK9aGExS3ZmtPDI7kmYdjNi9uRJ62+vq5TbmN9n0TNM9YLAI/XrDNLlAtNnY4ymy34fs+W53PQS+a5nVmlcBdazCdULE/rh8kCtNL/wsSOYn580yHv9kzOjpTvahmELF/Qq8yHYpGOWnN1MfzR+1owAHeFbwnPrtrKm9Us+F+QoK4RWn6T88PwF7EAGGYIe09g1bxInOLZdhapWMknE5phJF2NNzjnuS+GkbyHPVH0bsyl3qx9Y3ksEMYCsY70vsSZlTaTPzpm0me5Ndj7iCSRHi/JT6xKY6ignW4bExeaAmxfZ2rPC41c6q52Bq0Ypl2CZFU1+tCPULA0LQ55MclAtHjCJwkNq6ZVPlIB7yTa9BJAew1pYXg+BVGZfGm5NFKQ8+nOduRG5dkZcl9Do+qRmPzcEUYKIMzpokTVOII3I/gUyivPMaSIlsfDBB/LAOchU8F28pbgFKRhWIeBlpfm1iZmEcA+BBZf2f5ADtM6ALiQwiV/xpkXaTXA2rL5OVnL25Enrb6+rlNuY32fRM0z1gsAj9esM0uUC02djjKbLc3DkRzNAKe5XfC5BLfPatQ7u2KZH7JVdntoAHarZJTWQ==' WHERE ALIAS = 'taskListFiledConf';

-- 2023-09-12 jjx 修改流转任务接收人表审批意见值为500
ALTER TABLE BPM_TRANS_RECEIVER   MODIFY ("OPINION_" VARCHAR2(500));

-- 2023-09-13 jjx 修改日志配置form默认为开启
UPDATE portal_sys_logs_settings SET STATUS_ = '1' WHERE ID_ = '3';

-- 2023-09-21 liangjc 对话框树形数据旧数据修复
ALTER TABLE form_custom_dialog MODIFY TREE_DATA_MODE_ DEFAULT 0;
update form_custom_dialog set TREE_DATA_MODE_=0 where TREE_DATA_MODE_ is null;