diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-11 13:33:09 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-12 20:58:34 -0400 |
commit | 52039edadd2f35c2de12878ea939742773fac87d (patch) | |
tree | c6587ebc43b9e6dbca38685b4be30f2bdcb4893e /adapters/mso-catalog-db-adapter/src | |
parent | 48478b9531fb2901c392ce1142f9443b5d805148 (diff) |
vnr vrf fk issue
Updated flyway migration script to rename object as per review
comments. Used Tosca node type for determining VRF and VNF nodes
updated code based on review comments for schema.sql
Altered ConfigurationCustomizationResource for VRF-VNF to have
bidirectional relationship
ToscaResourceInstaller ConfigurationResourceCustomization was made
bidrectional
Change-Id: Ib45151ff7a40edca38d512ae76f8889b1cc4d0c4
Issue-ID: SO-1777
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src')
-rw-r--r-- | adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql) | 0 | ||||
-rw-r--r-- | adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql | 75 |
2 files changed, 75 insertions, 0 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql index e44a6b97ba..e44a6b97ba 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql new file mode 100644 index 0000000000..b39331234d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql @@ -0,0 +1,75 @@ +USE catalogdb; + +/* Drop existing foreign key */ +ALTER TABLE `catalogdb`.`configuration_customization` +DROP FOREIGN KEY IF EXISTS `fk_configuration_customization__configuration_customization1`; + +ALTER TABLE `catalogdb`.`configuration_customization` +DROP FOREIGN KEY IF EXISTS `fk_configuration_resource_customization__configuration_resour1`; +/* Drop existing index */ +ALTER TABLE `catalogdb`.`configuration_customization` +DROP INDEX IF EXISTS `fk_configuration_customization__configuration_customization_idx` ; + +/* Create a new table */ +CREATE TABLE `tmp_configuration_customization` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_ROLE` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) DEFAULT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`) , + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE + +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; + +/* Migrate the existing data */ +INSERT INTO tmp_configuration_customization +(`model_customization_uuid` , + `model_instance_name`, + `configuration_type` , + `configuration_role` , + `configuration_function` , + `creation_timestamp` , + `configuration_model_uuid` , + `service_proxy_customization_model_customization_uuid` , + `service_model_uuid`) +SELECT `config`.`model_customization_uuid`, + `config`.`model_instance_name`, + `config`.`configuration_type`, + `config`.`configuration_role`, + `config`.`configuration_function`, + `config`.`creation_timestamp`, + `config`.`configuration_model_uuid`, + `config`.`service_proxy_customization_model_customization_uuid`, + `svc`.`model_uuid` service_model_uuid FROM + configuration_customization config, + service svc, + configuration_customization_to_service config_svc +WHERE + config_svc.service_model_uuid = svc.model_uuid + AND config_svc.resource_model_customization_uuid = config.model_customization_uuid; + +/* Drop the old tables */ + +DROP TABLE `catalogdb`.`configuration_customization`; + +DROP TABLE `catalogdb`.`configuration_customization_to_service`; + +/* Rename the table */ +RENAME TABLE tmp_configuration_customization TO configuration_customization; + +
\ No newline at end of file |