/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SCH_JOBPARAMS' AND KSQL_COL_NAME ='FMUST') 
 ALTER TABLE T_SCH_JOBPARAMS ADD (FMUST CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SCH_JOBPARAMS' AND KSQL_COL_NAME ='FPARAMTYPE') 
 ALTER TABLE T_SCH_JOBPARAMS ADD (FPARAMTYPE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SCH_JOBPARAMS' AND KSQL_COL_NAME ='FPARAMDEFVALUE') 
 ALTER TABLE T_SCH_JOBPARAMS ADD (FPARAMDEFVALUE NVARCHAR(512));
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SCH_JOBPARAMS' AND KSQL_COL_NAME IN ('FBASEDATAINFO')) 
 ALTER TABLE T_SCH_JOBPARAMS ADD (FBASEDATAINFO VARCHAR(512));

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SCH_TASK_HISTORY') 
 CREATE TABLE T_SCH_TASK_HISTORY (
FID VARCHAR(36) DEFAULT ' ' NOT NULL,
FJOBID VARCHAR(36) DEFAULT ' ' NOT NULL,
FRUNAT VARCHAR(100) DEFAULT ' ' NOT NULL,
FPROGRESS INT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FDATA NCLOB,
FDISPATCHTIME DATETIME,
FRUNTIME DATETIME,
FENDTIME DATETIME,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FSCHEDULEID VARCHAR(36) DEFAULT ' ' NOT NULL,
FTIMEOUT INT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FCANSTOP CHAR(1) DEFAULT '0' NOT NULL
);

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_table.sql **/
