/**Begin D:\PDM_UPGRADE\PDM1\HRSS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SECONDFILTER_L') 
 CREATE TABLE T_HRSS_SECONDFILTER_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FFILTERDISPLAYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SEARCHPROJECT_L') 
 CREATE TABLE T_HRSS_SEARCHPROJECT_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSEARCHDISPLAYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SCENEENTITY') 
 CREATE TABLE T_HRSS_SCENEENTITY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FVIEWNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTITYTYPEID VARCHAR(18) DEFAULT ' ' NOT NULL,
FISVIEW CHAR(1) DEFAULT ' ' NOT NULL,
FISPERMFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FQUERYFIELD BIGINT DEFAULT 0 NOT NULL,
FFIELDSOURCE VARCHAR(20) DEFAULT ' ' NOT NULL,
FLABEL BIGINT DEFAULT 0 NOT NULL,
FSEARCHFIELDTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SEARCHPROJECT') 
 CREATE TABLE T_HRSS_SEARCHPROJECT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSEARCHDISPLAYNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSEARCHINFOTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FSEARCHMODE VARCHAR(20) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FRANGENUMBER NCLOB
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SEARCHPAGE') 
 CREATE TABLE T_HRSS_SEARCHPAGE (
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_HRSS_SCENEENTITY_L') 
 CREATE TABLE T_HRSS_SCENEENTITY_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FVIEWNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SEARCHSCENECFG') 
 CREATE TABLE T_HRSS_SEARCHSCENECFG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FSEARCHCATEGORY VARCHAR(20) DEFAULT ' ' NOT NULL,
FSEARCHKEYTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSEARCHOBJID BIGINT DEFAULT 0 NOT NULL,
FGPTPROMPTID BIGINT DEFAULT 0 NOT NULL,
FCOPYWRITING NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRSS_SECONDFILTER') 
 CREATE TABLE T_HRSS_SECONDFILTER (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSEARCHOBJFIELDID BIGINT DEFAULT 0 NOT NULL,
FFIELDTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FFILTERDISPLAYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMMONFILTER CHAR(1) DEFAULT ' ' NOT NULL,
FCUSTOMFILTERID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRSS_SEARCHCONFIG' AND KSQL_COL_NAME ='FCREATORID') 
 ALTER TABLE T_HRSS_SEARCHCONFIG ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRSS_SEARCHCONFIG' AND KSQL_COL_NAME ='FCREATETIME') 
 ALTER TABLE T_HRSS_SEARCHCONFIG ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRSS_SEARCHCONFIG' AND KSQL_COL_NAME ='FMODIFIERID') 
 ALTER TABLE T_HRSS_SEARCHCONFIG ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRSS_SEARCHCONFIG' AND KSQL_COL_NAME ='FMODIFYTIME') 
 ALTER TABLE T_HRSS_SEARCHCONFIG ADD (FMODIFYTIME DATETIME );

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