/**Begin D:\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ACTIVITY' AND KSQL_COL_NAME ='FADMINORGID') 
 ALTER TABLE T_HRCS_ACTIVITY ADD (FADMINORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ACTSCHEME' AND KSQL_COL_NAME ='FADMINORGID') 
 ALTER TABLE T_HRCS_ACTSCHEME ADD (FADMINORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_GROUPENTRY') 
 CREATE TABLE T_HRCS_GROUPENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACTGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FACTGROUPDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCONDITION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ACTGROUPENTITY') 
 CREATE TABLE T_HRCS_ACTGROUPENTITY (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FGROUPACTIVITYID BIGINT DEFAULT 0 NOT NULL,
FACTIVITYTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_GROUPENTRY_L') 
 CREATE TABLE T_HRCS_GROUPENTRY_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FACTGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FACTGROUPDESC NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ACTIVIGPINSENTITY') 
 CREATE TABLE T_HRCS_ACTIVIGPINSENTITY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACTIVITYID BIGINT DEFAULT 0 NOT NULL,
FACTIVITYTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ACTIVITYGROUPINS') 
 CREATE TABLE T_HRCS_ACTIVITYGROUPINS (
FID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZBILLID BIGINT DEFAULT 0 NOT NULL,
FACTIVITYGROUPID 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_1.4\PDM_UPGRADE\PDM1\HRCS_table.sql **/
