
CREATE TABLE PARTY_STRUCT_RULE(
        STRUCT_TYPE_ID BIGINT NOT NULL,
        PARENT_TYPE_ID BIGINT NOT NULL,
	CHILD_TYPE_ID BIGINT NOT NULL,
	DIM_ID BIGINT,
	SCOPE_ID VARCHAR(50),
        CONSTRAINT PK_PARTY_STRUCT_RULE PRIMARY KEY(STRUCT_TYPE_ID,PARENT_TYPE_ID,CHILD_TYPE_ID),
        CONSTRAINT FK_PARTY_STRUCT_RULE_TYPE FOREIGN KEY(STRUCT_TYPE_ID) REFERENCES PARTY_STRUCT_TYPE(ID),
        CONSTRAINT FK_PARTY_STRUCT_RULE_TYPE_PARENT FOREIGN KEY(PARENT_TYPE_ID) REFERENCES PARTY_TYPE(ID),
        CONSTRAINT FK_PARTY_STRUCT_RULE_TYPE_CHILD FOREIGN KEY(CHILD_TYPE_ID) REFERENCES PARTY_TYPE(ID),
        CONSTRAINT FK_PARTY_STRUCT_RULE_DIM FOREIGN KEY(DIM_ID) REFERENCES PARTY_DIM(ID)
) ENGINE=INNODB CHARSET=UTF8;






