-- 发票云附件分录表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_INVOICEATTACHINFO')
CREATE TABLE T_ER_INVOICEATTACHINFO
(
    FID            BIGINT DEFAULT 0 NOT NULL,
    FENTRYID       BIGINT DEFAULT 0 NOT NULL,
    FSEQ           INT    DEFAULT 0 NOT NULL,
    FATTACHNO      NVARCHAR(80) DEFAULT ' ' NOT NULL,
    FATTACHNAME    VARCHAR(255),
    FORIGINALNAME  VARCHAR(255),
    FATTACHTYPE    VARCHAR(30),
    FGATHERTIME    DATETIME,
    FATTACHREMARK  NVARCHAR(1024),
    FATTACHURL     VARCHAR(512),
    FSNAPSHOTURL   VARCHAR(512),
    FROTATIONANGLE VARCHAR(30)
);
-- 索引
EXEC P_ALTERPK 'PK_T_ER_INVOICEATTACHINFO', 'T_ER_INVOICEATTACHINFO', 'FENTRYID', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_INVOICEATTACHINFO' AND KSQL_INDNAME = 'IDX_ER_INVOICEATTACHINFO_FID') CREATE  CLUSTERED INDEX IDX_ER_INVOICEATTACHINFO_FID ON T_ER_INVOICEATTACHINFO ( FID );


