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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEDIMVAL' AND KSQL_COL_NAME IN ('FOTCLASSID')) 
 ALTER TABLE T_HRCS_ROLEDIMVAL ADD (FOTCLASSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEDIMVAL' AND KSQL_COL_NAME IN ('FADMINCONTAINSSUB')) 
 ALTER TABLE T_HRCS_ROLEDIMVAL ADD (FADMINCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_USERROLEDIMVAL' AND KSQL_COL_NAME IN ('FOTCLASSID')) 
 ALTER TABLE T_HRCS_USERROLEDIMVAL ADD (FOTCLASSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_USERROLEDIMVAL' AND KSQL_COL_NAME IN ('FADMINCONTAINSSUB')) 
 ALTER TABLE T_HRCS_USERROLEDIMVAL ADD (FADMINCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_DIMENSION' AND KSQL_COL_NAME IN ('FTEAMTYPEID')) 
 ALTER TABLE T_HRCS_DIMENSION ADD (FTEAMTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ENTITYCROSSOT') 
 CREATE TABLE T_HRCS_ENTITYCROSSOT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_CROSSOT') 
 CREATE TABLE T_HRCS_CROSSOT (
FID BIGINT DEFAULT 0 NOT NULL,
FOTCLASSID BIGINT DEFAULT 0 NOT NULL,
FCROSSOTCLASSID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);

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