/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYSEXT_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_GROUP_L') 
 CREATE TABLE T_KS_SCRIPTLET_GROUP_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFULLNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_L') 
 CREATE TABLE T_KS_SCRIPTLET_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTITLE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_CONTROL') 
 CREATE TABLE T_KS_CONTROL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONTROL_NAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10),
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCONTROL_LEVEL VARCHAR(50),
FCONTROL_TYPE VARCHAR(50),
FMODULE VARCHAR(255),
FLIMIT_RUNTIME DECIMAL(23,10)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_CONTROL_SCRIPT') 
 CREATE TABLE T_KS_CONTROL_SCRIPT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FSCRIPT_BASEDATA VARCHAR(50)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_MONITOR') 
 CREATE TABLE T_KS_MONITOR (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10),
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FSCRIPT_BASEDATA VARCHAR(50),
FALL_COUNT BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_MONITOR_LOG') 
 CREATE TABLE T_KS_MONITOR_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FEXEC_SCENE VARCHAR(50),
FEXEC_MAX_TIME DECIMAL(23,10),
FEXEC_TIME DECIMAL(23,10),
FEXEC_COUNT BIGINT,
FEXEC_IS_EXCEPTION VARCHAR(50),
FEXEC_EXCEPTION_CONTEXT VARCHAR(255),
FEXEC_EXCEPTION_CONTEXT_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET') 
 CREATE TABLE T_KS_SCRIPTLET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FTITLE VARCHAR(50),
FSCRIPT_CONTEXT VARCHAR(255),
FSCRIPT_CONTEXT_TAG NCLOB,
FSCRIPT_IMPORT_CODE VARCHAR(50)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_GROUP') 
 CREATE TABLE T_KS_SCRIPTLET_GROUP (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FLONGNUMBER VARCHAR(504),
FLEVEL BIGINT,
FISLEAF CHAR(1),
FPARENTID BIGINT
);



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