/**Begin D:\PDM_UPGRADE\PDM1\HRPTMC_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ESINDEX') 
 CREATE TABLE T_HRPTMC_ESINDEX (
FID VARCHAR(200) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FBASEDATAESINDEX 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_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ESMAPPING') 
 CREATE TABLE T_HRPTMC_ESMAPPING (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBERALIAS VARCHAR(200) DEFAULT ' ' NOT NULL,
FFIELDALIAS VARCHAR(200) DEFAULT ' ' NOT NULL,
FESFIELDKEY VARCHAR(200) DEFAULT ' ' NOT NULL,
FESINDEXID 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_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_SHARERECORD') 
 CREATE TABLE T_HRPTMC_SHARERECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FREPORTID BIGINT DEFAULT 0 NOT NULL,
FSHAREUSERID BIGINT DEFAULT 0 NOT NULL,
FONLYQUERYRESULT CHAR(1) DEFAULT ' ' NOT NULL,
FEXPIRATION DATETIME,
FNOTICETYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCONTENT VARCHAR(500) DEFAULT ' ' NOT NULL,
FSTARTTIME DATETIME,
FENDTIME DATETIME,
FSHARESOURCE VARCHAR(20) DEFAULT ' ' NOT NULL,
FRUNSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FREPORTSUBSCRIBEID BIGINT DEFAULT 0 NOT NULL,
FUSERPERMFILTER NCLOB,
FSHARESTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FESINDEXID VARCHAR(200) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_MYSUBSCRIBE') 
 CREATE TABLE T_HRPTMC_MYSUBSCRIBE (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FSUBSCRIBERECORD BIGINT DEFAULT 0 NOT NULL,
FUSER BIGINT DEFAULT 0 NOT NULL,
FSTARTTIME DATETIME,
FENDTIME DATETIME,
FESINDEXID VARCHAR(200) DEFAULT ' ' NOT NULL,
FREPORTID BIGINT DEFAULT 0 NOT NULL,
FRUNSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FCOUNT INT DEFAULT 0 NOT NULL,
FTRACEID VARCHAR(150) DEFAULT ' ' NOT NULL,
FERRORMSG VARCHAR(1000) DEFAULT ' ' NOT NULL,
FDATAQFILTER NCLOB,
FF7QFILTER NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_RECEIVEUSER') 
 CREATE TABLE T_HRPTMC_RECEIVEUSER (
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_HRPTMC_SHAREFILTERRANGE') 
 CREATE TABLE T_HRPTMC_SHAREFILTERRANGE (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSHARERECORD BIGINT DEFAULT 0 NOT NULL,
FFIELDALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
FFILTERTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FFILTERRANGE NCLOB,
FFILTERDEFAULT NCLOB,
FSTARTDATEDEFAULT VARCHAR(50) DEFAULT ' ' NOT NULL,
FENDDATEDEFAULT VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_SUBSCRIBERECORD') 
 CREATE TABLE T_HRPTMC_SUBSCRIBERECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCYCLE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCRON VARCHAR(300) DEFAULT ' ' NOT NULL,
FCRONLAST VARCHAR(300) DEFAULT ' ' NOT NULL,
FSCHEPLANID VARCHAR(19) DEFAULT ' ' NOT NULL,
FSCHEPLANLASTID VARCHAR(19) DEFAULT ' ' NOT NULL,
FSCHEJOBID VARCHAR(19) DEFAULT ' ' NOT NULL,
FRUNSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FREPORTID BIGINT DEFAULT 0 NOT NULL,
FUSER BIGINT DEFAULT 0 NOT NULL,
FREPORTGROUP BIGINT DEFAULT 0 NOT NULL
);


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



/**End D:\PDM_UPGRADE\PDM1\HRPTMC_table.sql **/
