-- TCC本地事务表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_DTX_LOCAL_TX_LOG')
 CREATE TABLE T_DTX_LOCAL_TX_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FXID VARCHAR(100) DEFAULT ' ' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCLOUD_ID VARCHAR(100) DEFAULT ' ' NOT NULL,
FAPP_ID VARCHAR(100) DEFAULT ' ' NOT NULL,
FRESOURCE VARCHAR(100) DEFAULT ' ' NOT NULL,
FPARA_TYPE VARCHAR(1000) DEFAULT ' ' NOT NULL,
FPARAS NCLOB,
FCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZID VARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATE_TIME DATETIME
);
-- 以下只是表中字段的解释，无需执行
-- COMMENT ON TABLE t_dtx_local_tx_log IS 'TCC本地事务日志表';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fxid IS '全局事务ID';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fseq IS '序号';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fresource IS '资源名称';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fpara_type IS '参数类型';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fparas IS '参数';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fcode IS '分支事务场景编码';
-- COMMENT ON COLUMN t_dtx_local_tx_log.fbizid IS '业务ID';

-- 幂等性本地记录表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IDEM_RPCIDEMPOTENTPROCESS')
 CREATE TABLE T_IDEM_RPCIDEMPOTENTPROCESS (
FIDEMPOTENTKEY VARCHAR(64) DEFAULT ' ' NOT NULL,
FCREATEDTIME DATETIME,
FRENEWALINSTANCE VARCHAR(20) DEFAULT ' ' NOT NULL,
FRENEWALTIME BIGINT DEFAULT 0 NOT NULL,
FALIVEDTIME BIGINT DEFAULT 0 NOT NULL,
FRESULT NCLOB,
FEXECUTESTATUS CHAR(1) DEFAULT '0' NOT NULL
);
-- 以下只是表中字段的解释，无需执行
-- COMMENT ON TABLE t_idem_rpcidempotentprocess IS '幂等性本地表';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.fidempotentkey IS '幂等唯一标识';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.fcreatedtime IS '创建时间';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.frenewalinstance IS 'jvm实例启动时间';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.frenewaltime IS '最新续约时间';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.falivedtime IS '有效时长';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.fresult IS '执行结果';
-- COMMENT ON COLUMN t_idem_rpcidempotentprocess.fexecutestatus IS '执行状态';