Problem

Xray 7.X introduces a series of data structure changes. Every relation pointing to a Test now points to a Test version. This data transformation is done using an Upgrade Task that runs once. 

Downgrading from Xray 7.X to a previous version may have side effects if you have created new versions. 

Executing the following queries when downgrading will result in losing data forever. For example, if you have created more versions for a test issue, the data (test type, test definition, preconditions, datasets, etc.) of the non-default versions will be lost. 

And data related to versions; please look intoXray 7.0.0 Release Notes. 


If you are on Xray Enterprise and using Test Case Versioning, do not proceed and reach out to the Xray Support Team, first.

There can be two cases,  
A) The first one is where Xray is upgraded from 6.X to 7.X and  
B) The second one would be when you have upgraded to 7.X but also downgraded to 6.X  

 
In both cases, the error appears on Test cases like the below: 



A) For the first case, when Xray is upgraded from 6.X to 7.X. Follow the steps in the exact sequence as mentioned below:


1) Create a backup of your instance. 
2) Disable the Xray plugin. 
3) Run the following queries (Note: the following queries should only be done when asked by the Xray team) 
 

delete from "AO_8B1069_TEST_CHANGE";   
truncate "AO_8B1069_GENERIC_DEFINITION"; 
truncate "AO_8B1069_CUCUMBER_DEFINITION"; 
UPDATE "AO_8B1069_TEST_PRE_COND_LINK" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_PARAM" SET "SUB_ENTITY_ID" = null; 
UPDATE "AO_8B1069_TEST_STEP" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_AUTOMATED_STEP_ISSUE" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_ENTITY_DATASET_SIZE" SET "SUB_ENTITY_ID" = null; 
UPDATE "AO_8B1069_TEST_RUN" SET "TEST_VERSION_ID" = null; 
delete from "AO_8B1069_TEST_VERSION";  



Preconditions validation: Check forthe unlikely caseof having the same precondition linked more than once to the same test


select count(*), "TARGET_ISSUE", "SOURCE_ISSUE" from "AO_8B1069_TEST_PRE_COND_LINK" group by "TARGET_ISSUE", "SOURCE_ISSUE" HAVING count(*)>1 

Preconditions validation: If the previous query returned results, then delete the duplicated occurrences using the query of your choice 

 


Get upgrade number IDs 


select ps.* from propertystring ps join propertyentry pe on pe.id=ps.id where property_key like '%xray%'; 

  

update propertystring set propertyvalue = 2007000000 where ID in (<ids from the previous query that has the value greater than 2007000001); 


Re-run thisselect query to validate that the values have been changed. 

 

select ps.* from propertystring ps join propertyentry pe on pe.id=ps.id where property_key like '%xray%';   


 
4) Once all the steps are completed, please enable the Xray plugin and check if you still are getting the errors. If yes, then reach out to the Xray support team.  



B) Now, for the second case, when Xray is upgraded to 7.X and then downgraded to 6.X


1) Create a backup of your instance. 
2) Uninstall the Xray plugin.  
3) Run the following queries (Note: the following queries should only be done when asked by the Xray team) 

 

delete from "AO_8B1069_TEST_CHANGE";   
truncate "AO_8B1069_GENERIC_DEFINITION"; 
truncate "AO_8B1069_CUCUMBER_DEFINITION"; 
UPDATE "AO_8B1069_TEST_PRE_COND_LINK" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_PARAM" SET "SUB_ENTITY_ID" = null; 
UPDATE "AO_8B1069_TEST_STEP" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_AUTOMATED_STEP_ISSUE" SET "TEST_VERSION_ID" = null; 
UPDATE "AO_8B1069_ENTITY_DATASET_SIZE" SET "SUB_ENTITY_ID" = null; 
UPDATE "AO_8B1069_TEST_RUN" SET "TEST_VERSION_ID" = null; 
delete from "AO_8B1069_TEST_VERSION";  


 

Preconditions validation: Check forthe unlikely caseof having the same precondition linked more than once to the same test 
 

select count(*), "TARGET_ISSUE", "SOURCE_ISSUE" from "AO_8B1069_TEST_PRE_COND_LINK" group by "TARGET_ISSUE", "SOURCE_ISSUE" HAVING count(*)>1 

Preconditions validation: If the previous query returned results, then delete the duplicated occurrences using the query of your choice 

 

 

Get upgrade number IDs 


select ps.* from propertystring ps join propertyentry pe on pe.id=ps.id where property_key like '%xray%'; 

  

update propertystring set propertyvalue = 2007000000 where ID in (<ids from the previous query that has the value greater than 2007000001); 


Re-run thisselect query to validate that the values have been changed. 

 

select ps.* from propertystring ps join propertyentry pe on pe.id=ps.id where property_key like '%xray%';   


 
4) Once that is done, please try to install the latest version (7.X). If you still are getting the error, please reach out to the Xray support team.