
USE `catalogdb`;

CREATE TABLE `allotted_resource` (
  `MODEL_UUID` varchar(200) NOT NULL,
  `MODEL_INVARIANT_UUID` varchar(200) NOT NULL,
  `MODEL_VERSION` varchar(20) NOT NULL,
  `MODEL_NAME` varchar(200) NOT NULL,
  `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
  `SUBCATEGORY` varchar(200) DEFAULT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`MODEL_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `allotted_resource_customization` (
  `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
  `PROVIDING_SERVICE_MODEL_UUID` varchar(200) DEFAULT NULL,
  `PROVIDING_SERVICE_MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
  `PROVIDING_SERVICE_MODEL_NAME` varchar(200) DEFAULT NULL,
  `TARGET_NETWORK_ROLE` varchar(200) DEFAULT NULL,
  `NF_TYPE` varchar(200) DEFAULT NULL,
  `NF_ROLE` varchar(200) DEFAULT NULL,
  `NF_FUNCTION` varchar(200) DEFAULT NULL,
  `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
  `MIN_INSTANCES` int(11) DEFAULT NULL,
  `MAX_INSTANCES` int(11) DEFAULT NULL,
  `AR_MODEL_UUID` varchar(200) NOT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
  KEY `fk_allotted_resource_customization__allotted_resource1_idx` (`AR_MODEL_UUID`),
  CONSTRAINT `fk_allotted_resource_customization__allotted_resource1` FOREIGN KEY (`AR_MODEL_UUID`) REFERENCES `allotted_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `heat_environment` (
  `ARTIFACT_UUID` varchar(200) NOT NULL,
  `NAME` varchar(100) NOT NULL,
  `VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `BODY` longtext NOT NULL,
  `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD',
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ARTIFACT_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `heat_files` (
  `ARTIFACT_UUID` varchar(200) NOT NULL,
  `NAME` varchar(200) NOT NULL,
  `VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `BODY` longtext NOT NULL,
  `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD',
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ARTIFACT_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `heat_template` (
  `ARTIFACT_UUID` varchar(200) NOT NULL,
  `NAME` varchar(200) NOT NULL,
  `VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `BODY` longtext NOT NULL,
  `TIMEOUT_MINUTES` int(11) DEFAULT NULL,
  `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD',
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ARTIFACT_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `heat_nested_template` (
  `PARENT_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL,
  `CHILD_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL,
  `PROVIDER_RESOURCE_FILE` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`PARENT_HEAT_TEMPLATE_UUID`,`CHILD_HEAT_TEMPLATE_UUID`),
  KEY `fk_heat_nested_template__heat_template2_idx` (`CHILD_HEAT_TEMPLATE_UUID`),
  CONSTRAINT `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` FOREIGN KEY (`CHILD_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` FOREIGN KEY (`PARENT_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `heat_template_params` (
  `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL,
  `PARAM_NAME` varchar(100) NOT NULL,
  `IS_REQUIRED` bit(1) NOT NULL,
  `PARAM_TYPE` varchar(20) DEFAULT NULL,
  `PARAM_ALIAS` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`,`PARAM_NAME`),
  CONSTRAINT `fk_heat_template_params__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `network_recipe` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `MODEL_NAME` varchar(20) NOT NULL,
  `ACTION` varchar(50) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `ORCHESTRATION_URI` varchar(256) NOT NULL,
  `NETWORK_PARAM_XSD` varchar(2048) DEFAULT NULL,
  `RECIPE_TIMEOUT` int(11) DEFAULT NULL,
  `SERVICE_TYPE` varchar(45) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `VERSION_STR` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_rl4f296i0p8lyokxveaiwkayi` (`MODEL_NAME`,`ACTION`,`VERSION_STR`)
) ENGINE=InnoDB AUTO_INCREMENT=178 DEFAULT CHARSET=latin1;

CREATE TABLE `temp_network_heat_template_lookup` (
  `NETWORK_RESOURCE_MODEL_NAME` varchar(200) NOT NULL,
  `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL,
  `AIC_VERSION_MIN` varchar(20) NOT NULL,
  `AIC_VERSION_MAX` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`NETWORK_RESOURCE_MODEL_NAME`),
  KEY `fk_temp_network_heat_template_lookup__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`),
  CONSTRAINT `fk_temp_network_heat_template_lookup__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `network_resource` (
  `MODEL_UUID` varchar(200) NOT NULL,
  `MODEL_NAME` varchar(200) NOT NULL,
  `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL,
  `NEUTRON_NETWORK_TYPE` varchar(20) DEFAULT NULL,
  `MODEL_VERSION` varchar(20) DEFAULT NULL,
  `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
  `AIC_VERSION_MIN` varchar(20) NOT NULL,
  `AIC_VERSION_MAX` varchar(20) DEFAULT NULL,
  `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT',
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`MODEL_UUID`),
  KEY `fk_network_resource__temp_network_heat_template_lookup1_idx` (`MODEL_NAME`),
  KEY `fk_network_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`),
  CONSTRAINT `fk_network_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE,
  CONSTRAINT `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` FOREIGN KEY (`MODEL_NAME`) REFERENCES `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `network_resource_customization` (
  `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
  `NETWORK_TECHNOLOGY` varchar(45) DEFAULT NULL,
  `NETWORK_TYPE` varchar(45) DEFAULT NULL,
  `NETWORK_ROLE` varchar(200) DEFAULT NULL,
  `NETWORK_SCOPE` varchar(45) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `NETWORK_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
  PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
  KEY `fk_network_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID`),
  CONSTRAINT `fk_network_resource_customization__network_resource1` FOREIGN KEY (`NETWORK_RESOURCE_MODEL_UUID`) REFERENCES `network_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `tosca_csar` (
  `ARTIFACT_UUID` varchar(200) NOT NULL,
  `NAME` varchar(200) NOT NULL,
  `VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `ARTIFACT_CHECKSUM` varchar(200) NOT NULL,
  `URL` varchar(200) NOT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ARTIFACT_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `service` (
  `MODEL_UUID` varchar(200) NOT NULL,
  `MODEL_NAME` varchar(200) NOT NULL,
  `MODEL_INVARIANT_UUID` varchar(200) NOT NULL,
  `MODEL_VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  `SERVICE_TYPE` varchar(200) DEFAULT NULL,
  `SERVICE_ROLE` varchar(200) DEFAULT NULL,
  `ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
  `WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`MODEL_UUID`),
  KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
  CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `service_recipe` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ACTION` varchar(50) NOT NULL,
  `VERSION_STR` varchar(20) DEFAULT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `ORCHESTRATION_URI` varchar(256) NOT NULL,
  `SERVICE_PARAM_XSD` varchar(2048) DEFAULT NULL,
  `RECIPE_TIMEOUT` int(11) DEFAULT NULL,
  `SERVICE_TIMEOUT_INTERIM` int(11) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_7fav5dkux2v8g9d2i5ymudlgc` (`SERVICE_MODEL_UUID`,`ACTION`),
  KEY `fk_service_recipe__service1_idx` (`SERVICE_MODEL_UUID`),
  CONSTRAINT `fk_service_recipe__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1;

CREATE TABLE `service_to_resource_customizations` (
  `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
  `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `MODEL_TYPE` varchar(20) NOT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`,`MODEL_TYPE`),
  KEY `fk_service_to_resource_cust__service_model_uuid_idx` (`SERVICE_MODEL_UUID`),
  KEY `fk_service_to_resource_cust__resource_model_customiz_uuid_idx` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`),
  CONSTRAINT `fk_service_to_resource_cust__service__model_uuid0` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vnf_components` (
  `VNF_ID` int(11) NOT NULL,
  `COMPONENT_TYPE` varchar(20) NOT NULL,
  `HEAT_TEMPLATE_ID` int(11) DEFAULT NULL,
  `HEAT_ENVIRONMENT_ID` int(11) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`VNF_ID`,`COMPONENT_TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vnf_components_recipe` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `VNF_TYPE` varchar(200) DEFAULT NULL,
  `VNF_COMPONENT_TYPE` varchar(45) NOT NULL,
  `ACTION` varchar(50) NOT NULL,
  `SERVICE_TYPE` varchar(45) DEFAULT NULL,
  `VERSION` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `ORCHESTRATION_URI` varchar(256) NOT NULL,
  `VNF_COMPONENT_PARAM_XSD` varchar(2048) DEFAULT NULL,
  `RECIPE_TIMEOUT` int(11) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP,
  `VF_MODULE_MODEL_UUID` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_4dpdwddaaclhc11wxsb7h59ma` (`VF_MODULE_MODEL_UUID`,`VNF_COMPONENT_TYPE`,`ACTION`,`VERSION`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;

CREATE TABLE `vnf_recipe` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `VNF_TYPE` varchar(200) DEFAULT NULL,
  `ACTION` varchar(50) NOT NULL,
  `SERVICE_TYPE` varchar(45) DEFAULT NULL,
  `VERSION_STR` varchar(20) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `ORCHESTRATION_URI` varchar(256) NOT NULL,
  `VNF_PARAM_XSD` varchar(2048) DEFAULT NULL,
  `RECIPE_TIMEOUT` int(11) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP,
  `VF_MODULE_ID` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_f3tvqau498vrifq3cr8qnigkr` (`VF_MODULE_ID`,`ACTION`,`VERSION_STR`)
) ENGINE=InnoDB AUTO_INCREMENT=10006 DEFAULT CHARSET=latin1;

CREATE TABLE `vnf_resource` (
  `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `MODEL_UUID` varchar(200) NOT NULL,
  `AIC_VERSION_MIN` varchar(20) DEFAULT NULL,
  `AIC_VERSION_MAX` varchar(20) DEFAULT NULL,
  `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
  `MODEL_VERSION` varchar(20) NOT NULL,
  `MODEL_NAME` varchar(200) DEFAULT NULL,
  `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
  `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`MODEL_UUID`),
  KEY `fk_vnf_resource__heat_template1` (`HEAT_TEMPLATE_ARTIFACT_UUID`),
  CONSTRAINT `fk_vnf_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vnf_resource_customization` (
  `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
  `MIN_INSTANCES` int(11) DEFAULT NULL,
  `MAX_INSTANCES` int(11) DEFAULT NULL,
  `AVAILABILITY_ZONE_MAX_COUNT` int(11) DEFAULT NULL,
  `NF_TYPE` varchar(200) DEFAULT NULL,
  `NF_ROLE` varchar(200) DEFAULT NULL,
  `NF_FUNCTION` varchar(200) DEFAULT NULL,
  `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
  `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
  KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
  CONSTRAINT `fk_vnf_resource_customization__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


CREATE TABLE `vf_module` (
  `MODEL_UUID` varchar(200) NOT NULL,
  `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
  `MODEL_VERSION` varchar(20) NOT NULL,
  `MODEL_NAME` varchar(200) NOT NULL,
  `DESCRIPTION` varchar(1200) DEFAULT NULL,
  `IS_BASE` int(11) NOT NULL,
  `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
  PRIMARY KEY (`MODEL_UUID`,`VNF_RESOURCE_MODEL_UUID`),
  KEY `fk_vf_module__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
  KEY `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`),
  KEY `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`),
  CONSTRAINT `fk_vf_module__heat_template_art_uuid__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vf_module__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vf_module__vol_heat_template_art_uuid__heat_template2` FOREIGN KEY (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vf_module_customization` (
  `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `LABEL` varchar(200) DEFAULT NULL,
  `INITIAL_COUNT` int(11) DEFAULT '0',
  `MIN_INSTANCES` int(11) DEFAULT '0',
  `MAX_INSTANCES` int(11) DEFAULT NULL,
  `AVAILABILITY_ZONE_COUNT` int(11) DEFAULT NULL,
  `HEAT_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  `VOL_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL,
  PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
  KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`),
  KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`),
  KEY `fk_vf_module_customization__vol_env__heat_environment2_idx` (`VOL_ENVIRONMENT_ARTIFACT_UUID`),
  CONSTRAINT `fk_vf_module_customization__heat_env__heat_environment1` FOREIGN KEY (`HEAT_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vf_module_customization__vf_module1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vf_module_customization__vol_env__heat_environment2` FOREIGN KEY (`VOL_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `vf_module_to_heat_files` (
  `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL,
  `HEAT_FILES_ARTIFACT_UUID` varchar(200) NOT NULL,
  PRIMARY KEY (`VF_MODULE_MODEL_UUID`,`HEAT_FILES_ARTIFACT_UUID`),
  KEY `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`HEAT_FILES_ARTIFACT_UUID`),
  CONSTRAINT `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` FOREIGN KEY (`HEAT_FILES_ARTIFACT_UUID`) REFERENCES `heat_files` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vf_module_to_heat_files__vf_module__model_uuid1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='il fait ce qu''il dit';


CREATE TABLE `vnf_res_custom_to_vf_module_custom` (
  `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
  `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`,`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`),
  KEY `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`),
  CONSTRAINT `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


