/**Begin D:\zhaohui_zeng\PDM_UPGRADE\pdm1\MSPLAN_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_METASQL_CHECKLOG' AND KSQL_COL_NAME ='FSQL')
ALTER TABLE T_MSPLAN_METASQL_CHECKLOG ADD (FSQL NVARCHAR(2000) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_METASQL_CHECKLOG' AND KSQL_COL_NAME ='FERRORTYPE')
ALTER TABLE T_MSPLAN_METASQL_CHECKLOG ADD (FERRORTYPE NVARCHAR(10) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_METASQL_CHECKLOG' AND KSQL_COL_NAME ='FISWHITELIST')
ALTER TABLE T_MSPLAN_METASQL_CHECKLOG ADD (FISWHITELIST CHAR(1) DEFAULT '0' NOT NULL);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_METASQL_BUGLOG')
 CREATE TABLE T_MSPLAN_METASQL_BUGLOG (
FBUILDID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FGITBRANCH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FERRORTYPE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FEXCEPTIONINFO NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FAPPID NVARCHAR(20) DEFAULT ' ' NOT NULL,
FSQLNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FID BIGINT DEFAULT 0 NOT NULL,
FMETADATAKEY NVARCHAR(120) DEFAULT ' ' NOT NULL,
FTABLENAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FSQL NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FHOST NVARCHAR(120) DEFAULT ' ' NOT NULL,
FBUGNO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUGSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_METASQL_WHITELS')
 CREATE TABLE T_MSPLAN_METASQL_WHITELS (
FGITBRANCH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FERRORTYPE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FAPPID NVARCHAR(20) DEFAULT ' ' NOT NULL,
FSQLNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FMETADATAKEY NVARCHAR(120) DEFAULT ' ' NOT NULL,
FTABLENAME NVARCHAR(120) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_METASQL_PARAMSET')
 CREATE TABLE T_MSPLAN_METASQL_PARAMSET (
FHOST NVARCHAR(120) DEFAULT ' ' NOT NULL,
FAPPNAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FAPPID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPSECURET NVARCHAR(512) DEFAULT ' ' NOT NULL,
FTENANTID NVARCHAR(120) DEFAULT ' ' NOT NULL,
FACCOUNTID NVARCHAR(120) DEFAULT ' ' NOT NULL,
FPARAMTYPE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPIC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISPROCONFIG CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_METASQL_CALCSET')
 CREATE TABLE T_MSPLAN_METASQL_CALCSET (
FNUMBER NVARCHAR(120) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPARAMTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPARAM NVARCHAR(512) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


/**End D:\zhaohui_zeng\PDM_UPGRADE\pdm1\MSPLAN_table.sql **/
