/**BEGIN  **/
/**维度成员关系方案的维度表 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DIMENSIONRELATION_E')
CREATE TABLE T_EB_DIMENSIONRELATION_E
(
    FID             BIGINT          DEFAULT 0   NOT NULL,
    FENTRYID        BIGINT          DEFAULT 0   NOT NULL,
	FSEQ            BIGINT     		DEFAULT 0   NOT NULL,
	FDIMENSION      BIGINT          DEFAULT 0   NOT NULL,
    FDIMVIEW        BIGINT          DEFAULT 0   NOT NULL,
    FDIMPROPERTY    BIGINT          DEFAULT 0   NOT NULL
);
EXEC P_ALTERPK 'PK_T_EB_DIMENSIONRELATION_E', 'T_EB_DIMENSIONRELATION_E', 'FENTRYID', '1';
/**END **/

/**BEGIN  **/
/**预算模板维度成员关系方案表 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TEMPLATERELATION')
CREATE TABLE T_EB_TEMPLATERELATION
(
    FID            BIGINT       DEFAULT 0   NOT NULL,
    FPKID          BIGINT       DEFAULT 0   NOT NULL,
	FBASEDATAID    BIGINT     	DEFAULT 0   NOT NULL
	
);
EXEC P_ALTERPK 'PK_T_EB_TEMPLATERELATION', 'T_EB_TEMPLATERELATION', 'FPKID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TEMPLATERELATION')
CREATE INDEX IDX_EB_TEMPLATERELATION ON T_EB_TEMPLATERELATION (FID ASC);
/**END **/
