   KEY `idx_volume_remove_time` (`remove_time`),
   KEY `idx_volume_removed` (`removed`),
   KEY `idx_volume_state` (`state`),
+  KEY `idx_volume_external_id` (`external_id`),
+  KEY `idx_volume_uri` (`uri`(255)),
+  KEY `fk_volume__host_id` (`host_id`),
+  KEY `fk_volume__deployment_unit_id` (`deployment_unit_id`),
+  KEY `fk_volume__environment_id` (`environment_id`),
+  KEY `fk_volume__volume_template_id` (`volume_template_id`),
+  KEY `fk_volume__storage_driver_id` (`storage_driver_id`),
   CONSTRAINT `fk_volume__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_volume__deployment_unit_id` FOREIGN KEY (`deployment_unit_id`) REFERENCES `deployment_unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_volume__environment_id` FOREIGN KEY (`environment_id`) REFERENCES `environment` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_volume__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `fk_volume__image_id` FOREIGN KEY (`image_id`) REFERENCES `image` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `fk_volume__instance_id` FOREIGN KEY (`instance_id`) REFERENCES `instance` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `fk_volume__offering_id` FOREIGN KEY (`offering_id`) REFERENCES `offering` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_volume__storage_driver_id` FOREIGN KEY (`storage_driver_id`) REFERENCES `storage_driver` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_volume__volume_template_id` FOREIGN KEY (`volume_template_id`) REFERENCES `volume_template` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `fk_volume__zone_id` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;

-- Table structure for table `host_vnet_map`
--

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `host_vnet_map` (

UNLOCK TABLES;

--
-- Table structure for table `deployment_unit`
--

DROP TABLE IF EXISTS `deployment_unit`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deployment_unit` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `kind` varchar(255) NOT NULL,
  `uuid` varchar(128) NOT NULL,
  `description` varchar(1024) DEFAULT NULL,
  `state` varchar(128) NOT NULL,
  `created` datetime DEFAULT NULL,
  `removed` datetime DEFAULT NULL,
  `remove_time` datetime DEFAULT NULL,
  `data` text,
  `service_index` varchar(255) DEFAULT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_deployment_unit_uuid` (`uuid`),
  KEY `fk_deployment_unit__account_id` (`account_id`),
  KEY `fk_deployment_unit__service_id` (`service_id`),
  KEY `idx_deployment_unit_name` (`name`),
  KEY `idx_deployment_unit_remove_time` (`remove_time`),
  KEY `idx_deployment_unit_removed` (`removed`),
  KEY `idx_deployment_unit_state` (`state`),
  CONSTRAINT `fk_deployment_unit__service_id` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_deployment_unit__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `deployment_unit`
--

LOCK TABLES `deployment_unit` WRITE;
/*!40000 ALTER TABLE `deployment_unit` DISABLE KEYS */;
/*!40000 ALTER TABLE `deployment_unit` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `dynamic_schema`
--

DROP TABLE IF EXISTS `dynamic_schema`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dynamic_schema` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `kind` varchar(255) NOT NULL,
  `uuid` varchar(128) NOT NULL,
  `description` varchar(1024) DEFAULT NULL,
  `state` varchar(128) NOT NULL,
  `created` datetime DEFAULT NULL,
  `data` text,
  `parent` varchar(255) DEFAULT NULL,
  `definition` mediumtext,
  `service_id` bigint(20) DEFAULT NULL,
  `removed` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_dynamic_schema_uuid` (`uuid`),
  KEY `fk_dynamic_schema__account_id` (`account_id`),
  KEY `fk_dynamic_schema__service_id` (`service_id`),
  KEY `idx_dynamic_schema_name` (`name`),
  KEY `idx_dynamic_schema_state` (`state`),
  KEY `idx_dynamic_schema_removed` (`removed`),
  CONSTRAINT `fk_dynamic_schema__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_dynamic_schema__service_id` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `dynamic_schema`
--

LOCK TABLES `dynamic_schema` WRITE;
/*!40000 ALTER TABLE `dynamic_schema` DISABLE KEYS */;
/*!40000 ALTER TABLE `dynamic_schema` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `dynamic_schema_role`
--

DROP TABLE IF EXISTS `dynamic_schema_role`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dynamic_schema_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `dynamic_schema_id` bigint(20) DEFAULT NULL,
  `role` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_dynamic_schema_role_dynamic_schema_id` (`dynamic_schema_id`),
  CONSTRAINT `fk_dynamic_schema_role_dynamic_schema_id` FOREIGN KEY (`dynamic_schema_id`) REFERENCES `dynamic_schema` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `dynamic_schema_role`
--

LOCK TABLES `dynamic_schema_role` WRITE;
/*!40000 ALTER TABLE `dynamic_schema_role` DISABLE KEYS */;
/*!40000 ALTER TABLE `dynamic_schema_role` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `environment`
--

DROP TABLE IF EXISTS `environment`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `environment` (
