/**Begin C:\PDM_UPGRADE\PDM1\PBD_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_DATA_SYNC_TRIGGER') 
 CREATE TABLE T_PBD_DATA_SYNC_TRIGGER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FEVENTS NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINTERVAL NVARCHAR(10) DEFAULT ' ' NOT NULL,
FSCHEDULE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVALIDATED_TIME DATETIME,
FEXPIRED_TIME DATETIME,
FJOB_DEFINEID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FJOB_SCHEDULEID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FTRIGGED_TIME DATETIME,
FTOTAL_COUNT BIGINT DEFAULT 0 NOT NULL,
FEXE_JOB_USERID BIGINT DEFAULT 0 NOT NULL,
FESCONFIGID BIGINT DEFAULT 0 NOT NULL,
FTRIGGER_TYPE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FHANDLER NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESAGGS') 
 CREATE TABLE T_PBD_ESAGGS (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FFIELDID BIGINT DEFAULT 0 NOT NULL,
FPATH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FESAGGTYPEID BIGINT DEFAULT 0 NOT NULL,
FSIZE INT DEFAULT 0 NOT NULL,
FINDEXENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESAGGS_OUTPUT') 
 CREATE TABLE T_PBD_ESAGGS_OUTPUT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FEVALPATH NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISARRAY CHAR(1) DEFAULT '0' NOT NULL,
FFIXEVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFIELDKEY VARCHAR(80) DEFAULT ' ' NOT NULL,
FFIELDTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESAGGS_SUB') 
 CREATE TABLE T_PBD_ESAGGS_SUB (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESAGGTYPE') 
 CREATE TABLE T_PBD_ESAGGTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FAGGTYPEHANDLER VARCHAR(100) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESCONFIG') 
 CREATE TABLE T_PBD_ESCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FREGION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINDEXENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL,
FFILTERCONDITION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FINDEXKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FESOUTPUTID BIGINT DEFAULT 0 NOT NULL,
FPARENTESCONFIGID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESCONFIGAGGENTRY') 
 CREATE TABLE T_PBD_ESCONFIGAGGENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FESAGGREGATIONID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESCONFIGENTRY') 
 CREATE TABLE T_PBD_ESCONFIGENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FESMAPPINGID BIGINT DEFAULT 0 NOT NULL,
FISPRIMARYKEY CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESMAPPINGPROP') 
 CREATE TABLE T_PBD_ESMAPPINGPROP (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDATATYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMAPPINGFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FESTOKENIZERTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FWITHPINYIN CHAR(1) DEFAULT '0' NOT NULL,
FBOOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINDEXENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL,
FDEFAULTVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESMAPPINGPROP_NESTS') 
 CREATE TABLE T_PBD_ESMAPPINGPROP_NESTS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESOUTPUT') 
 CREATE TABLE T_PBD_ESOUTPUT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEXENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL,
FTARGETID VARCHAR(36) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ESOUTPUTENTRY') 
 CREATE TABLE T_PBD_ESOUTPUTENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FFIELDKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISARRAY CHAR(1) DEFAULT '0' NOT NULL,
FFIXEVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEVALPATH NVARCHAR(255) DEFAULT ' ' NOT NULL,
FESMAPPINGID BIGINT DEFAULT 0 NOT NULL,
FCANDIDATEKEY CHAR(1) DEFAULT '0' NOT NULL
);



/**End C:\PDM_UPGRADE\PDM1\PBD_table.sql **/
