summaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:32 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:46 -0500
commita85dc14805068ac6ab6eab7efd5d10459ee3ebc2 (patch)
tree534d0ff4078ec82b21e4fe21c639722ebf4ac1a0 /adapters/mso-catalog-db-adapter
parentde5958dddd97b086ec8b603974f434fd814386ac (diff)
Service Proxy Consolidation
- Updated ServiceProxyResourceCustomization to remove the ID column - Removed setConfigurationResourceCustomization from serviceProxyResource since that relationship doesn't exist anymore - Updated ServiceProxy resource to remove the object dependencies between ServiceProxyCustomization and ConfigurationResourceCustomization - Removed the delete statement since this is causing the test to fail because the service table doesn't exist yet - Updated configuration_customization to drop the serviceProxyCustomization FK - Added migration script to consolidate the ServiceProxy and ServiceProxyCustomization into a single table and migrate the data. - Code changes to support consolidating the ServiceProxy and ServiceProxyCustomization table into a single table Change-Id: I1e49cb22c8b667f157dd1c349b5e36fd06236630 Issue-ID: SO-1380 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.1__ServiceProxyTableConsolidation.sql44
1 files changed, 44 insertions, 0 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.1__ServiceProxyTableConsolidation.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.1__ServiceProxyTableConsolidation.sql
new file mode 100644
index 0000000000..c196f8f6e3
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.1__ServiceProxyTableConsolidation.sql
@@ -0,0 +1,44 @@
+use catalogdb;
+
+/* Consolidate Service_Proxy_Customization and Service_Proxy tables into a new table also called Service_Proxy_Customization */
+
+ALTER TABLE service_proxy_customization DROP FOREIGN KEY fk_service_proxy_resource_customization__service1;
+
+ALTER TABLE service_proxy_customization DROP FOREIGN KEY fk_spr_customization__service_proxy_resource1;
+
+ALTER TABLE configuration_customization DROP FOREIGN KEY fk_configuration_customization__service_proxy_customization1;
+
+CREATE TABLE IF NOT EXISTS `service_proxy_customization_temp` (
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `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) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_service_proxy_resource_customization__service1`
+ FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`)
+ REFERENCES `catalogdb`.`service` (`MODEL_UUID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+INSERT INTO catalogdb.service_proxy_customization_temp (model_customization_uuid,model_instance_name,model_uuid,model_invariant_uuid,model_version,model_name,tosca_node_type,description,source_service_model_uuid)
+SELECT T1.model_customization_uuid, T1.model_instance_name,T2.model_uuid, T2.model_invariant_uuid, T2.model_version, T2.model_name, T1.tosca_node_type, T2.description, T1.source_service_model_uuid
+ FROM catalogdb.service_proxy_customization T1
+ JOIN catalogdb.service_proxy T2 ON T1.service_proxy_model_uuid = T2.model_uuid;
+
+DROP TABLE service_proxy_customization;
+
+DROP TABLE service_proxy;
+
+RENAME TABLE service_proxy_customization_temp TO service_proxy_customization;