/**Begin C:\Users\rd_jin_gu\Documents\work\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_TASKCONFIG' AND KSQL_COL_NAME ='FNUMBER') 
 ALTER TABLE T_HRCS_TASKCONFIG ADD (FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_TASKCONFIG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HRCS_TASKCONFIG ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_TASKCONFIG' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HRCS_TASKCONFIG ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_TASKCONFIGSERVICE') 
 CREATE TABLE T_HRCS_TASKCONFIGSERVICE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FENTITY VARCHAR(36) DEFAULT ' ' NOT NULL,
FSERVICE VARCHAR(255) DEFAULT ' ' NOT NULL,
FMETHOD VARCHAR(255) DEFAULT ' ' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_TASKCONFIGEXCL') 
 CREATE TABLE T_HRCS_TASKCONFIGEXCL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FENTITY VARCHAR(36) DEFAULT ' ' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL
);


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ENTITYDEPENDENT') 
 CREATE TABLE T_HRCS_ENTITYDEPENDENT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_EDENTITY') 
 CREATE TABLE T_HRCS_EDENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FEDID BIGINT DEFAULT 0 NOT NULL,
FENTITY VARCHAR(36) DEFAULT ' ' NOT NULL,
FROW VARCHAR(20) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_EDENTITYREL') 
 CREATE TABLE T_HRCS_EDENTITYREL (
FID BIGINT DEFAULT 0 NOT NULL,
FEDID BIGINT DEFAULT 0 NOT NULL,
FEDENTITYID BIGINT DEFAULT 0 NOT NULL,
FEDJOINENTITYID BIGINT DEFAULT 0 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_HRCS_EDENTITYRELENTRY') 
 CREATE TABLE T_HRCS_EDENTITYRELENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLEFTPROP VARCHAR(200) DEFAULT ' ' NOT NULL,
FCOMPARETYPE VARCHAR(10) DEFAULT '=' NOT NULL,
FRIGHTPROP VARCHAR(200) DEFAULT ' ' NOT NULL
);


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



/**End C:\Users\rd_jin_gu\Documents\work\PDM_UPGRADE\PDM1\HRCS_table.sql **/
