4.1.0或4.1.1升级至4.2说明
本次升级为知识包添加了编码属性,系统数据库需要添加这个字段,并确保值非空。新版本获取知识包可以通过code获取:
KnowledgeService service=(KnowledgeService)Utils.getApplicationContext().getBean(KnowledgeService.BEAN_ID);
//通过KnowledgeService接口获取指定编码的知识包"JWFP_FP"
KnowledgePackage knowledgePackage=service.getKnowledge("JWFP_FP");
你可以通过如下的脚步自动完成这个工作:
mysql,hsql
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=UUID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
oracle
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=SYS_GUID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
sqlserver, sybase
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=NEWID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
postgresql
首先确保postgresql安装了uuid函数 如果是pgcrypto 扩展函数,则代码如下:
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=gen_random_uuid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
如果是uuid-ossp 扩展函数,则代码如下:
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=uuid_generate_v1() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
informix
要有一个自定义的uuid生成函数,例如:
create function sys_guid() returning varchar(36);
define guid varchar(50);
let guid =replace(cast(dbms_lob_new_clob(to_char(sysdate,'%H:%M:%S.%FS')) as lvarchar(36)),'0000','');
return guid;
end function;
然后调整urule的表:
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=sys_guid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);
informix
要有一个自定义的uuid生成函数,例如:
--uuid()
CREATE FUNCTION uuid() RETURNS VARCHAR(50)
LANGUAGE SQL
BEGIN
DECLARE RESULT VARCHAR(50) DEFAULT '';
DECLARE a VARCHAR(18) DEFAULT '';
DECLARE b VARCHAR(18) DEFAULT '';
SET a = substr(hex(DECIMAL(TO_CHAR(CURRENT_TIMESTAMP,'yyyyMMddHH24miss'))),1,16);
SET b = substr(hex(MICROSECOND(CURRENT_TIMESTAMP)* RAND()* RAND()* 1000000),1,16);
SET RESULT = a || '-' || b ;
RETURN RESULT;
END
然后调整urule的表:
alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=uuid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);