
/** 方案表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_NOTICE')
CREATE TABLE T_EB_NOTICE (
	FID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME DATETIME ,
	FMODIFYTIME DATETIME ,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FPUSHTIMEASSISTANT CHAR(1)  DEFAULT '0' NOT NULL,
	FINSTANTPUSH CHAR(1)  DEFAULT '0' NOT NULL,
	FSTARTTIME DATETIME ,
	FENDTIME DATETIME ,
	FREMIND NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FPUSHMESSAGECENTER CHAR(1)  DEFAULT '0' NOT NULL,
	FNUMBER NVARCHAR(30) DEFAULT ' '  NOT NULL,
	FCONTENT NVARCHAR(255) DEFAULT ' '  NOT NULL,
	FCONTENT_TAG NCLOB DEFAULT ' '  NOT NULL,
	FPURPOSE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FABLE CHAR(1)  DEFAULT '1' NOT NULL,
	FNAME NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FSCHEMETYPE NVARCHAR(50) DEFAULT ' '  NOT NULL
);
EXEC P_ALTERPK 'PK_EB_NOTICE', 'T_EB_NOTICE', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_NOTICE_L')
CREATE TABLE T_EB_NOTICE_L (
	FPKID NVARCHAR(50)  NOT NULL,
	FID BIGINT DEFAULT 0 NOT NULL,
	FLOCALEID NVARCHAR(10) DEFAULT ' '  NOT NULL,
	FTITLE NVARCHAR(200) DEFAULT ' '  NOT NULL,
	FNAME NVARCHAR(50) DEFAULT ' '  NOT NULL
);
EXEC P_ALTERPK 'PK_EB_NOTICE_L', 'T_EB_NOTICE_L', 'FPKID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_NOTICE_L_0')
CREATE INDEX IDX_EB_NOTICE_L_0 ON T_EB_NOTICE_L ( FID, FLOCALEID );



/**快照表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANNOUNCEMENT_CONTENT')
CREATE TABLE T_EB_ANNOUNCEMENT_CONTENT (
	FID BIGINT DEFAULT 0 NOT NULL,
	FMNTSCHEME BIGINT DEFAULT 0 NOT NULL,
	FTITLE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FCONTENT NVARCHAR(2000) DEFAULT ' '  NOT NULL,
	FPUSHMESSAGECENTER CHAR(1)  DEFAULT '0' NOT NULL,
	FPUSHTIMEASSISTANT CHAR(1)  DEFAULT '0' NOT NULL,
	FINSTANTPUSH CHAR(1)  DEFAULT '1' NOT NULL,
	FSTARTTIME DATETIME,
	FENDTIME DATETIME,
	FREMIND NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FMODIFIERFIELD BIGINT  DEFAULT 0 NOT NULL,
	FCREATERFIELD BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATEFIELD DATETIME ,
	FCREATEDATEFIELD DATETIME ,
	FMODEL BIGINT DEFAULT 0 NOT NULL,
	FSCHEMETYPE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FISSENDMESSAGE CHAR(1)  DEFAULT '0' NOT NULL,
	FISCLOSE CHAR(1)  DEFAULT '0' NOT NULL
);
EXEC P_ALTERPK 'PK_EB_ANNOUNCEMENT_CONTENT', 'T_EB_ANNOUNCEMENT_CONTENT', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANNOUNCEMENT_CONTENT_L')
CREATE TABLE T_EB_ANNOUNCEMENT_CONTENT_L (
	FPKID NVARCHAR(36)   NOT NULL,
	FID BIGINT DEFAULT 0 NOT NULL,
	FLOCALEID NVARCHAR(10) DEFAULT ' '  NOT NULL,
	FTITLE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	CONSTRAINT PK_EB_ANNOUNCEMENT_CONTENT_L PRIMARY KEY (FPKID)
);
EXEC P_ALTERPK 'PK_EB_ANNOUNCEMENT_CONTENT_L', 'T_EB_ANNOUNCEMENT_CONTENT_L', 'FPKID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANNOUNCEMENT_CONTENT_L_0')
CREATE INDEX IDX_EB_ANNOUNCEMENT_CONTENT_L_0 ON T_EB_ANNOUNCEMENT_CONTENT_L ( FID, FLOCALEID );


/** 执行计划表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MNT_EXECUTEPLAN')
CREATE TABLE T_EB_MNT_EXECUTEPLAN (
	FID BIGINT DEFAULT 0 NOT NULL,
	FMNTSCHEME BIGINT DEFAULT 0 NOT NULL,
	FANNOUNCEMENTCONTENT BIGINT DEFAULT 0 NOT NULL,
	FMODEL BIGINT DEFAULT 0 NOT NULL,
	FPURPOSE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FSTATUS NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FCREATEUSER BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME DATETIME ,
	FCHANNEL NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FCONTENT NVARCHAR(50) DEFAULT ' '  NOT NULL
);
EXEC P_ALTERPK 'PK_EB_MNT_EXECUTEPLAN', 'T_EB_MNT_EXECUTEPLAN', 'FID', '1';



/** 执行计划与调度计划关联表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MNT_PLANJOBENTRY')
CREATE TABLE T_EB_MNT_PLANJOBENTRY (
	FID  BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FJOB NVARCHAR(36) DEFAULT ' '  NOT NULL,
	FPLAN NVARCHAR(36) DEFAULT ' '  NOT NULL,
	FPLANTYPE NVARCHAR(50) DEFAULT ' '  NOT NULL
);
EXEC P_ALTERPK 'PK_EB_MNT_PLANJOBENTRY', 'T_EB_MNT_PLANJOBENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_MNT_PLANJOBENTRY_FK')
CREATE INDEX IDX_EB_MNT_PLANJOBENTRY_FK ON T_EB_MNT_PLANJOBENTRY ( FID );



/**执行日志表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MNT_EXECUTELOG')
CREATE TABLE T_EB_MNT_EXECUTELOG (
	FID BIGINT DEFAULT 0 NOT NULL,
	FMNTSCHEME BIGINT DEFAULT 0 NOT NULL,
	FANNOUNCEMENTCONTENT BIGINT DEFAULT 0 NOT NULL,
	FEXECUTETYPE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FACTIONTYPE NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FEXECUTERESULT NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FREASON NVARCHAR(100) DEFAULT ' '  NOT NULL,
	FEXECUTEUSER BIGINT DEFAULT 0 NOT NULL,
	FDATETIMEFIELD DATETIME ,
	FMODEL BIGINT DEFAULT 0 NOT NULL,
	FCHANNEL NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FCONTENT NVARCHAR(50) DEFAULT ' '  NOT NULL
);
EXEC P_ALTERPK 'PK_EB_MNT_EXECUTELOG', 'T_EB_MNT_EXECUTELOG', 'FID', '1';




