/**Begin D:\PDM_UPGRADE\PDM_UPGRADE\PDM1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_OFFSETCTRLCONF') 
 CREATE TABLE T_BCM_OFFSETCTRLCONF (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSCENARIOID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FINVCONTROL CHAR(1) DEFAULT '1' NOT NULL,
FCHECKCONTROL CHAR(1) DEFAULT '1' NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CONVERTDIFFENTITY' AND KSQL_COL_NAME IN ('FUNBIZRULE')) 
 ALTER TABLE T_BCM_CONVERTDIFFENTITY ADD (FUNBIZRULE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISMAPJSON') 
 CREATE TABLE T_BCM_ISMAPJSON (
FID BIGINT DEFAULT 0 NOT NULL,
FDIMMAPID BIGINT DEFAULT 0 NOT NULL,
FTYPE INT DEFAULT 1 NOT NULL,
FDATA NCLOB,
FSPREADJSON NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISGROUPMAP' AND KSQL_COL_NAME IN ('FSRCTYPE')) 
 ALTER TABLE T_BCM_ISGROUPMAP ADD (FSRCTYPE INT DEFAULT 1 NOT NULL );

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