-- T_FA_DISDEPRE_TASK表相关语句
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_DISDEPRE_TASK')
 CREATE TABLE T_FA_DISDEPRE_TASK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBATCHNO BIGINT DEFAULT 0 NOT NULL,
FIDS VARCHAR(255) DEFAULT ' ' NOT NULL,
FIDS_TAG NCLOB,
FERRORLOG VARCHAR(255) DEFAULT ' ' NOT NULL,
FERRORLOG_TAG NCLOB,
FPERCENT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCONSUMEINSTANCE VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FSTARTTIME DATETIME,
FENDTIME DATETIME
);

EXEC P_ALTERPK 'PK_T_FA_DISDEPRE_TASK', 'T_FA_DISDEPRE_TASK', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DTASK_FID') CREATE INDEX IDX_FA_DTASK_FID ON T_FA_DISDEPRE_TASK ( FID ,FENTRYSTATUS );


--T_FA_DISDEPRE_LOG表相关语句

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_DISDEPRE_LOG')
 CREATE TABLE T_FA_DISDEPRE_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FDEPREUSE BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FASSETBOOKID BIGINT DEFAULT 0 NOT NULL,
FISNEW CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FALLCOUNT BIGINT DEFAULT 0 NOT NULL,
FDEPREDCOUNT BIGINT DEFAULT 0 NOT NULL,
FISMANUAL CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FFROMENTITYNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FRESULT VARCHAR(255) DEFAULT ' ' NOT NULL,
FRESULT_TAG NCLOB,
FSUBSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FFINISHTIME DATETIME,
FNEEDLOCK CHAR(1) DEFAULT '0' NOT NULL,
FISMQDISDEPRE CHAR(1) DEFAULT '1' NOT NULL
);

EXEC P_ALTERPK 'PK_T_FA_DISDEPRE_LOG', 'T_FA_DISDEPRE_LOG', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DLOG_FASSETBOOKID') CREATE INDEX IDX_FA_DLOG_FASSETBOOKID ON T_FA_DISDEPRE_LOG ( FASSETBOOKID ,FPERIODID ,FFROMENTITYNAME ,FISMANUAL ,FISNEW );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DLOG_FORGID') CREATE INDEX IDX_FA_DLOG_FORGID ON T_FA_DISDEPRE_LOG ( FORGID ,FDEPREUSE ,FPERIODID ,FFROMENTITYNAME ,FISMANUAL );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_DLOG_FCREATETIME') CREATE INDEX IDX_FA_DLOG_FCREATETIME ON T_FA_DISDEPRE_LOG ( FCREATETIME  DESC );


