   `arhge_id` int(11) NOT NULL auto_increment,
   `hg_hg_id` int(11) default NULL,
   `acl_res_id` int(11) default NULL,
-  PRIMARY KEY  (`arhge_id`)
-) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+  PRIMARY KEY  (`arhge_id`),
+  KEY `hg_hg_id` (`hg_hg_id`),
+  KEY `acl_res_id` (`acl_res_id`),
+  KEY `hg_hg_id_2` (`hg_hg_id`,`acl_res_id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
 
 -- --------------------------------------------------------
 

  `acl_topo_name` varchar(255) default NULL,
  `acl_topo_alias` varchar(255) default NULL,
  `acl_topo_activate` enum('0','1') default NULL,
  PRIMARY KEY  (`acl_topo_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

ALTER TABLE `traps_service_relation`
  ADD CONSTRAINT `traps_service_relation_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `service` (`service_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `traps_service_relation_ibfk_3` FOREIGN KEY (`traps_id`) REFERENCES `traps` (`traps_id`) ON DELETE CASCADE;

--
-- Contraintes pour la table acl_resources_meta_relations
--

ALTER TABLE `acl_resources_meta_relations` ADD FOREIGN KEY ( `meta_id` ) REFERENCES `meta_service` (`meta_id`) ON DELETE CASCADE ;
ALTER TABLE `acl_resources_meta_relations` ADD FOREIGN KEY ( `acl_res_id` ) REFERENCES `acl_resources` (`acl_res_id`) ON DELETE CASCADE ;

--
-- Contraintes pour la table acl_actions_rules
--

ALTER TABLE `acl_actions_rules` ADD CONSTRAINT `acl_actions_rules_ibfk_1` FOREIGN KEY (`acl_action_rule_id`) REFERENCES `acl_actions` (`acl_action_id`) ON DELETE CASCADE;


--
-- Contraintes pour la table acl_resources_hg_relations
--

ALTER TABLE `acl_resources_hg_relations` ADD FOREIGN KEY ( `hg_hg_id` ) REFERENCES `hostgroup` (`hg_id`) ON DELETE CASCADE ;
ALTER TABLE `acl_resources_hg_relations` ADD FOREIGN KEY ( `acl_res_id` ) REFERENCES `acl_resources` (`acl_res_id`) ON DELETE CASCADE ;

--
-- Contraintes pour la table acl_resources_sg_relations
--

ALTER TABLE `acl_resources_sg_relations` ADD FOREIGN KEY ( `sg_id` ) REFERENCES `servicegroup` (`sg_id`) ON DELETE CASCADE ;
ALTER TABLE `acl_resources_sg_relations` ADD FOREIGN KEY ( `acl_res_id` ) REFERENCES `acl_resources` (`acl_res_id`) ON DELETE CASCADE ;

