/**BEGIN  **/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION') 
CREATE TABLE T_EB_RPA_INTEGRATION
(
    FID           BIGINT DEFAULT 0 NOT NULL,
    FMODELID      BIGINT DEFAULT 0 NOT NULL,
    FBIZMODELID   BIGINT DEFAULT 0 NOT NULL,
	FCATEID       BIGINT DEFAULT 0 NOT NULL,
    FNAME         NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FNUMBER       NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FDESCRIPTION  NVARCHAR(255) DEFAULT ' ' NOT NULL,
    FSTATUS       NVARCHAR(10)  DEFAULT ' ' NOT NULL,
    FSOURCE       NVARCHAR(10)  DEFAULT ' ' NOT NULL,
	FCREATORID    BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME   DATETIME,
	FMODIFIERID   BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME   DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION', 'T_EB_RPA_INTEGRATION', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_INTEGRATION')
CREATE INDEX IDX_RPA_INTEGRATION ON T_EB_RPA_INTEGRATION ( FMODELID );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_INTEGRATION_NUMBER')
CREATE INDEX IDX_RPA_INTEGRATION_NUMBER ON T_EB_RPA_INTEGRATION ( FNUMBER );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION_L')
CREATE TABLE T_EB_RPA_INTEGRATION_L
(
    FPKID        NVARCHAR(36)  DEFAULT ' ' NOT NULL,
    FID          BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID    NVARCHAR(10)  DEFAULT ' ' NOT NULL,
    FNAME        NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FDESCRIPTION  NVARCHAR(255) DEFAULT ' ' NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION_L', 'T_EB_RPA_INTEGRATION_L', 'FPKID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION_CATE') 
CREATE TABLE T_EB_RPA_INTEGRATION_CATE
(
    FID              BIGINT DEFAULT 0 NOT NULL,
    FMODELID         BIGINT DEFAULT 0 NOT NULL,
    FSEQUENCE        BIGINT DEFAULT 0 NOT NULL,
    FPARENTID        BIGINT DEFAULT 0 NOT NULL,
	FNUMBER          NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FCREATORID       BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME      DATETIME,
	FMODIFIERID      BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME      DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION_CATE', 'T_EB_RPA_INTEGRATION_CATE', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_INTEGRATION_CATE')
CREATE INDEX IDX_RPA_INTEGRATION_CATE ON T_EB_RPA_INTEGRATION_CATE ( FMODELID );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION_CATE_L')
CREATE TABLE T_EB_RPA_INTEGRATION_CATE_L
(
    FPKID        NVARCHAR(36)  DEFAULT ' ' NOT NULL,
    FID          BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID    NVARCHAR(10)  DEFAULT ' ' NOT NULL,
    FNAME        NVARCHAR(50)  DEFAULT ' ' NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION_CATE_L', 'T_EB_RPA_INTEGRATION_CATE_L', 'FPKID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_ENTITY_REF') 
CREATE TABLE T_EB_RPA_ENTITY_REF
(
    FID             BIGINT DEFAULT 0 NOT NULL,
    FCORPNUMBER     NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FCORPNAME       NVARCHAR(100) DEFAULT ' ' NOT NULL,
    FENTITYID       BIGINT DEFAULT 0 NOT NULL,
    FMODELID        BIGINT DEFAULT 0 NOT NULL,
    FRPAINTEID      BIGINT DEFAULT 0 NOT NULL,
    FREPORTTYPE     NVARCHAR(10) DEFAULT ' ' NOT NULL,
	FMODIFIERID     BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME     DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_ENTITY_REF', 'T_EB_RPA_ENTITY_REF', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_ENTITY_REF')
CREATE INDEX IDX_RPA_ENTITY_REF ON T_EB_RPA_ENTITY_REF ( FMODELID );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_ENTITY_REF_ENTITY')
CREATE INDEX IDX_RPA_ENTITY_REF_ENTITY ON T_EB_RPA_ENTITY_REF ( FENTITYID );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_ENTITY_REF_L')
CREATE TABLE T_EB_RPA_ENTITY_REF_L
(
    FPKID        NVARCHAR(36)  DEFAULT ' ' NOT NULL,
    FID          BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID    NVARCHAR(10)  DEFAULT ' ' NOT NULL,
    FCORPNAME    NVARCHAR(100)  DEFAULT ' ' NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_ENTITY_REF_L', 'T_EB_RPA_ENTITY_REF_L', 'FPKID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION_SHT') 
CREATE TABLE T_EB_RPA_INTEGRATION_SHT
(
    FID             BIGINT DEFAULT 0 NOT NULL,
	FSHEETNAME      NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FNUMBER         NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FNAME           NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FSEQNUM         BIGINT DEFAULT 0 NOT NULL,
    FRPAINTEID      BIGINT DEFAULT 0 NOT NULL,
    FTEMPLATEID     BIGINT DEFAULT 0 NOT NULL,
    FISFLOAT        NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FMAPPINGSTATUS  NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FEFFECTSTATUS   NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATORID      BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME     DATETIME,
	FMODIFIERID     BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME     DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION_SHT', 'T_EB_RPA_INTEGRATION_SHT', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_INTEGRATION_SHT')
CREATE INDEX IDX_RPA_INTEGRATION_SHT ON T_EB_RPA_INTEGRATION_SHT ( FRPAINTEID );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_INTEGRATION_CELL') 
CREATE TABLE T_EB_RPA_INTEGRATION_CELL
(
    FID          BIGINT DEFAULT 0 NOT NULL,
    FSHEETID     BIGINT DEFAULT 0 NOT NULL,
    FRPAINTEID   BIGINT DEFAULT 0 NOT NULL,
    FREFDATA     NVARCHAR(2000) DEFAULT ' ' NOT NULL,
	FSEQUENCE    BIGINT DEFAULT 0 NOT NULL,
	FMODIFIER    BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME  DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_INTEGRATION_CELL', 'T_EB_RPA_INTEGRATION_CELL', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_INTEGRATION_CELL')
CREATE INDEX IDX_RPA_INTEGRATION_CELL ON T_EB_RPA_INTEGRATION_CELL ( FSHEETID );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_SCHEME') 
CREATE TABLE T_EB_RPA_SCHEME
(
    FID               BIGINT DEFAULT 0 NOT NULL,
    FNAME             NVARCHAR(100) DEFAULT ' ' NOT NULL,
    FNUMBER           NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FBIZMODEL         BIGINT DEFAULT 0 NOT NULL,
	FMODEL            BIGINT DEFAULT 0 NOT NULL,
	FRPAINTEGRATION   BIGINT DEFAULT 0 NOT NULL,
	FEXPORTPATH       NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FINSTALLPATH      NVARCHAR(150) DEFAULT ' ' NOT NULL,
	FSTATUS           NVARCHAR(10) DEFAULT ' ' NOT NULL,
	FDATATYPE         BIGINT DEFAULT 0 NOT NULL,
	FVERSION          BIGINT DEFAULT 0 NOT NULL,
	FPERIOD           BIGINT DEFAULT 0 NOT NULL,
	FFILEPATTERN      NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FSHEETPATTERN     NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATEINI        NVARCHAR(10) DEFAULT ' ' NOT NULL,
	FRPAPROCESS       NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRPAROBOT         NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FDESCRIPTION      NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FFILENAME         NVARCHAR(1000) DEFAULT ' ' NOT NULL,
	FSHEETNAME        NVARCHAR(1000) DEFAULT ' ' NOT NULL,
	FCREATERID        BIGINT DEFAULT 0 NOT NULL,
	FCREATETIME       DATETIME,
	FMODIFIERID       BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME       DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_SCHEME', 'T_EB_RPA_SCHEME', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_SCHEME')
CREATE INDEX IDX_RPA_SCHEME ON T_EB_RPA_SCHEME ( FMODEL );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_SCHEME_NUMBER')
CREATE INDEX IDX_RPA_SCHEME_NUMBER ON T_EB_RPA_SCHEME ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_SCHEME_L')
CREATE TABLE T_EB_RPA_SCHEME_L
(
    FPKID          NVARCHAR(36)  DEFAULT ' ' NOT NULL,
    FID            BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID      NVARCHAR(10)  DEFAULT ' ' NOT NULL,
    FNAME          NVARCHAR(100)  DEFAULT ' ' NOT NULL,
    FDESCRIPTION   NVARCHAR(255)  DEFAULT ' ' NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_SCHEME_L', 'T_EB_RPA_SCHEME_L', 'FPKID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_SCHEME_ENTITY') 
CREATE TABLE T_EB_RPA_SCHEME_ENTITY
(
    FID           BIGINT DEFAULT 0 NOT NULL,
    FENTRYID      BIGINT DEFAULT 0 NOT NULL,
    FSEQ          BIGINT DEFAULT 0 NOT NULL,
    FENTITY       BIGINT DEFAULT 0 NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_SCHEME_ENTITY', 'T_EB_RPA_SCHEME_ENTITY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_SCHEME_TEMPLATE') 
CREATE TABLE T_EB_RPA_SCHEME_TEMPLATE
(
    FID           BIGINT DEFAULT 0 NOT NULL,
    FENTRYID      BIGINT DEFAULT 0 NOT NULL,
    FSEQ          BIGINT DEFAULT 0 NOT NULL,
    FTEMPLATE     BIGINT DEFAULT 0 NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_SCHEME_TEMPLATE', 'T_EB_RPA_SCHEME_TEMPLATE', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPA_TASK_LOG') 
CREATE TABLE T_EB_RPA_TASK_LOG
(
    FID                BIGINT DEFAULT 0 NOT NULL,
    FMODEL             BIGINT DEFAULT 0 NOT NULL,
    FBIZMODEL          BIGINT DEFAULT 0 NOT NULL,
    FSCHEME            BIGINT DEFAULT 0 NOT NULL,
	FDATATYPE          BIGINT DEFAULT 0 NOT NULL,
	FVERSION           BIGINT DEFAULT 0 NOT NULL,
	FPERIOD            BIGINT DEFAULT 0 NOT NULL,
    FTASKID            NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTITY            NVARCHAR(2000) DEFAULT ' ' NOT NULL,
	FTEMPLATE          NVARCHAR(2000) DEFAULT ' ' NOT NULL,
	FSTATUS            NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRPAPROCESS        NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRPAPROCESSCODE    NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRPAPROCESSVER     NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FROBOTNO           NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FROBOTNAME         NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FSTARTTIME         NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENDTIME           NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FDESCRIPTION       NVARCHAR(500) DEFAULT ' ' NOT NULL,
	FMODIFIERID        BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME        DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_RPA_TASK_LOG', 'T_EB_RPA_TASK_LOG', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_TASK_LOG')
CREATE INDEX IDX_RPA_TASK_LOG ON T_EB_RPA_TASK_LOG ( FTASKID );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_TASK_LOG_MODEL')
CREATE INDEX IDX_RPA_TASK_LOG_MODEL ON T_EB_RPA_TASK_LOG ( FMODEL );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RPA_TASK_LOG_SCHEME')
CREATE INDEX IDX_RPA_TASK_LOG_SCHEME ON T_EB_RPA_TASK_LOG ( FSCHEME );

/**END **/