Scenario: application export-import from 18.104.22.16828 environment to 22.214.171.12428.
Export is done successfully.
Import fails on following error message in nolio_export.log:
2020-10-23 12:58:38,493 [http-nio-8443-exec-6] ERROR (com.nolio.platform.server.dataservices.services.exportimport.model.importdata.ApplicationDataImporter:180) - Runtime exception caught while importing application
com.nolio.platform.server.dataservices.except.InputInvalidException: artifact definition with this name already exists. name:*************
The issue is related to the fact that there are 2 artifact definitions with the same name in the provided file. This is an issue in the data. It is prohibited by design to have artifact definitions with the same name, artifact type and application.
Release : 6.6,6.7
Component : CA RELEASE AUTOMATION CORE
Identifying Artifact Definition Duplication:
The below query should work for MySQL, SQL and Oracle in case of syntax conflict please modify below script depending on target DB type.
select app.app_name as application_name, ad.name as art_definition, at.name as artifact_type_name, count(ad.name) as total_occurrence from artifact_definition as ad join applications as app on app.id = ad.applicationId join artifact_type as at on at.id = ad.artifactType_id group by app.app_name, at.name, ad.name having count(ad.name) > 1
Removing Duplicated Record
Steps to Execute:
1: Copy the script(attached to this article for your respective DB type) and it will create a store-procedure sp_remove_artifact_definition
2: Execute the above created SP i.e. sp_remove_artifact_definition with artifact_definition_id's you want to remove by providing p_aritifact_definition_id highlighted below.
Note: Debug version of MySQL query is also attached to document, in case if you are getting error, you can use this script to create SP and run the same which will be capturing debug messages.
exec sp_remove_artifact_definition @p_artifact_definition_id=-1
3: After removal of corrupt data, please re-import the application export.