/**Begin D:\PDM_UPGRADE\NEWPDM\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_BGTASKREGISTER') 
 CREATE TABLE T_HRCS_BGTASKREGISTER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZCLOUDID VARCHAR(36) DEFAULT ' ' NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FTASKCLASSNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCLICKCLASSNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FTIMEOUT INT DEFAULT 0 NOT NULL,
FNEEDRESUME CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_BGTASKREGISTER_L') 
 CREATE TABLE T_HRCS_BGTASKREGISTER_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_BGTASKRECORD') 
 CREATE TABLE T_HRCS_BGTASKRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FBGTASKREGISTERID BIGINT DEFAULT 0 NOT NULL,
FTASKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTASKSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FSTARTTIME DATETIME,
FENDTIME DATETIME,
FJOBFORMINFO NCLOB,
FISCONFIRM CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_BGTASKSESSION') 
 CREATE TABLE T_HRCS_BGTASKSESSION (
FID BIGINT DEFAULT 0 NOT NULL,
FTASKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FGLOBALSESSIONID VARCHAR(200) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_BGTASKREGISTER' AND KSQL_COL_NAME IN ('FCALLBACKCLASSNAME')) 
 ALTER TABLE T_HRCS_BGTASKREGISTER ADD (FCALLBACKCLASSNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_BGTASKREGISTER' AND KSQL_COL_NAME IN ('FACTIONID')) 
 ALTER TABLE T_HRCS_BGTASKREGISTER ADD (FACTIONID NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_BGTASKRECORD' AND KSQL_COL_NAME IN ('FISBACKGROUND')) 
 ALTER TABLE T_HRCS_BGTASKRECORD ADD (FISBACKGROUND CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_BGTASKSESSION' AND KSQL_COL_NAME IN ('FISSTOP')) 
 ALTER TABLE T_HRCS_BGTASKSESSION ADD (FISSTOP CHAR(1) DEFAULT '0' NOT NULL );

/**End D:\PDM_UPGRADE\NEWPDM\HRCS_table.sql **/
