/**Begin D:\PDM\PDM_UPGRADE\pdm1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_UPGRADECONTENT') 
 CREATE TABLE T_BCM_UPGRADECONTENT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FTITLE NVARCHAR(200) DEFAULT ' ' NOT NULL,
FCONTENT NCLOB,
FDELEVERTIME DATETIME,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FWIN CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_UPGRADEDMODEL') 
 CREATE TABLE T_BCM_UPGRADEDMODEL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FUPGRADETIME DATETIME,
FDYCALTIME DATETIME,
FSEQ INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_UPGRADESTATUS') 
 CREATE TABLE T_BCM_UPGRADESTATUS (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FLOG NCLOB,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FLASTTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FSUBMITTIME') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FSUBMITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FRATIFIERID') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FRATIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FRATIFYTIME') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FRATIFYTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FREVIEWERID') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FREVIEWERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FREVIEWTIME') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FREVIEWTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FCALLBACKERID') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FCALLBACKERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FCALLBACKTIME') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FCALLBACKTIME DATETIME );

/**End D:\PDM\PDM_UPGRADE\pdm1\BCM_table.sql **/
