summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.1__ServiceProxyTableConsolidation.sql44
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql52
2 files changed, 67 insertions, 29 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;
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 0c67123f56..72810d6f3c 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -502,36 +502,30 @@ default character set = latin1;
engine = innodb auto_increment = 20654
default character set = latin1;
- create table if not exists `service_proxy` (
- `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,
- `description` varchar(1200) null,
- `creation_timestamp` datetime not null default current_timestamp,
- primary key (`model_uuid`))
- engine = innodb auto_increment = 20654
- default character set = latin1;
+ CREATE TABLE IF NOT EXISTS `service_proxy_customization` (
+ `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 `service` (`MODEL_UUID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
-create table if not exists `service_proxy_customization` (
-`model_customization_uuid` varchar(200) not null,
-`model_instance_name` varchar(200) not null,
-`tosca_node_type` varchar(200) not null,
-`source_service_model_uuid` varchar(200) not null,
-`creation_timestamp` datetime not null default current_timestamp,
-`service_proxy_model_uuid` varchar(200) not null,
-primary key (`model_customization_uuid`),
-index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc),
-index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc),
-constraint`fk_spr_customization__service_proxy_resource1`
-foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`)
-on delete cascade on update cascade,
-constraint `fk_service_proxy_resource_customization__service1`
-foreign key (`source_service_model_uuid`) references `service`
-(`model_uuid`) on delete cascade on update cascade)
-engine = innodb
-auto_increment = 20654
-default character set = latin1;
create table if not exists `configuration_customization` (
`model_customization_uuid` varchar(200) not null,