-- 供方记录表增加字段：项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROVIDERRECORD' AND KSQL_COL_NAME ='FPROJECTID')
ALTER TABLE T_MDS_PROVIDERRECORD ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 供方记录表增加字段：计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROVIDERRECORD' AND KSQL_COL_NAME ='FPLANSCOPEID')
ALTER TABLE T_MDS_PROVIDERRECORD ADD (FPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 供方记录表增加字段：辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROVIDERRECORD' AND KSQL_COL_NAME ='FAUXPROPERTYID')
ALTER TABLE T_MDS_PROVIDERRECORD ADD (FAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );

-- 供方记录表增加字段：配置号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROVIDERRECORD' AND KSQL_COL_NAME ='FCONFIGID')
ALTER TABLE T_MDS_PROVIDERRECORD ADD (FCONFIGID BIGINT DEFAULT 0 NOT NULL );

-- 需方记录表增加字段：项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_REQUESTRECORD' AND KSQL_COL_NAME ='FPROJECTID')
ALTER TABLE T_MDS_REQUESTRECORD ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 需方记录表增加字段：计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_REQUESTRECORD' AND KSQL_COL_NAME ='FPLANSCOPEID')
ALTER TABLE T_MDS_REQUESTRECORD ADD (FPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 需方记录表增加字段：辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_REQUESTRECORD' AND KSQL_COL_NAME ='FAUXPROPERTYID')
ALTER TABLE T_MDS_REQUESTRECORD ADD (FAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减定义增加字段：预测冲减维度
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SETOFFSETTING' AND KSQL_COL_NAME ='FSETOFFDIMID')
ALTER TABLE T_MDS_SETOFFSETTING ADD (FSETOFFDIMID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：需方项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPROJECTID')
ALTER TABLE T_MDS_FNREPORT ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：需方计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPLANSCOPEID')
ALTER TABLE T_MDS_FNREPORT ADD (FPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：需方辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FAUXPROPERTYID')
ALTER TABLE T_MDS_FNREPORT ADD (FAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：供方配置号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPROCONFIGID')
ALTER TABLE T_MDS_FNREPORT ADD (FPROCONFIGID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：供方项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPROPROJECTID')
ALTER TABLE T_MDS_FNREPORT ADD (FPROPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：供方计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPROPLANSCOPEID')
ALTER TABLE T_MDS_FNREPORT ADD (FPROPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减记录增加字段：供方辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORT' AND KSQL_COL_NAME ='FPROAUXPROPERTYID')
ALTER TABLE T_MDS_FNREPORT ADD (FPROAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：需方项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPROJECTID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：需方计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPLANSCOPEID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：需方辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FAUXPROPERTYID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：供方配置号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPROCONFIGID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPROCONFIGID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：供方项目号
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPROPROJECTID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPROPROJECTID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：供方计划范围
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPROPLANSCOPEID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPROPLANSCOPEID BIGINT DEFAULT 0 NOT NULL );

-- 预测冲减历史记录增加字段：供方辅助属性
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_FNREPORTBK' AND KSQL_COL_NAME ='FPROAUXPROPERTYID')
ALTER TABLE T_MDS_FNREPORTBK ADD (FPROAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL );