DROP TABLE IF EXISTS mocha_attributes; CREATE TABLE mocha_attributes ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, tenant_id INT, src_inst_id INT, att_inst_id INT, usr_inst_id INT, att_effective_date DATETIME, att_value TEXT, INDEX `att_index_FI_1` (tenant_id, src_inst_id, att_inst_id), CONSTRAINT `att_inst_id_FK_tenant` FOREIGN KEY (`tenant_id`) REFERENCES `mocha_tenants` (`id`), CONSTRAINT `att_inst_id_FK_src` FOREIGN KEY (`src_inst_id`) REFERENCES `mocha_instances` (`id`), CONSTRAINT `att_inst_id_FK_att` FOREIGN KEY (`att_inst_id`) REFERENCES `mocha_instances` (`id`), CONSTRAINT `att_inst_id_FK_usr` FOREIGN KEY (`usr_inst_id`) REFERENCES `mocha_instances` (`id`) );