/**Begin D:\\PDM_UPGRADE\PDM_UPGRADE\PDM1\HIES_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_SWITCHREGISTRY') 
 CREATE TABLE T_HIES_SWITCHREGISTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' 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 '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FOLDOP VARCHAR(100) DEFAULT ' ' NOT NULL,
FNEWOP VARCHAR(100) DEFAULT ' ' NOT NULL,
FOPTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FPERMITEM VARCHAR(100) DEFAULT ' ' NOT NULL,
FENABLESTATUS VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_SWITCHREGISTRY_L') 
 CREATE TABLE T_HIES_SWITCHREGISTRY_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
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_SWITCHREGISTRY' AND KSQL_COL_NAME IN ('FORISTATUS'))
ALTER TABLE T_HIES_SWITCHREGISTRY ADD (FORISTATUS VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HIES_SWITCHREGISTRY' AND KSQL_COL_NAME IN ('FAPISTATUS'))
ALTER TABLE T_HIES_SWITCHREGISTRY ADD (FAPISTATUS VARCHAR(10) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_SCHEMESWITCHSERREG')
 CREATE TABLE T_HIES_SCHEMESWITCHSERREG (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMSERVICEAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FMSERVICECLASS VARCHAR(100) DEFAULT ' ' NOT NULL,
FOLDVERSIONFLAG CHAR(1) DEFAULT '1' NOT NULL,
FSUCINVOKEFLAG CHAR(1) DEFAULT '0' NOT NULL
);



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