/**Begin D:\pdm\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_WARNSCENE' AND KSQL_COL_NAME ='FWARNFROMENTIY') 
 ALTER TABLE T_HRCS_WARNSCENE ADD (FWARNFROMENTIY VARCHAR(36) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_WARNSCENE' AND KSQL_COL_NAME ='FWARNBIZAPPID') 
 ALTER TABLE T_HRCS_WARNSCENE ADD (FWARNBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_WARNRCPERM')
CREATE TABLE T_HRCS_WARNRCPERM (
                                    FENTRYID BIGINT DEFAULT 0 NOT NULL,
									FID BIGINT DEFAULT 0 NOT NULL,
								    FSEQ INT DEFAULT 0 NOT NULL,
									FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
									FNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
									FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
									FFIELDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
									FFIELDALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
									FFIELDPATH VARCHAR(300) DEFAULT ' ' NOT NULL,
									FVALUETYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
									FWARNENTITYPERM BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_RCFIX' AND KSQL_COL_NAME ='FRCFIXUSERORG') 
 ALTER TABLE T_HRCS_RCFIX ADD (FRCFIXUSERORG VARCHAR(200) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_RCROLE')
CREATE TABLE T_HRCS_RCROLE (
                                    FENTRYID BIGINT DEFAULT 0 NOT NULL,
									FID BIGINT DEFAULT 0 NOT NULL,
								    FSEQ INT DEFAULT 0 NOT NULL,
									FPERMROLE VARCHAR(50) DEFAULT ' ' NOT NULL,
									FSOURCETYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
                                    FPERM CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_RCROLE' AND KSQL_COL_NAME ='FPERMROLE') 
 ALTER TABLE T_HRCS_RCROLE ADD (FPERMROLE VARCHAR(50) DEFAULT ' ' NOT NULL );

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