Remove duplicate Rank fields in Jira server
In JIRA Agile, it is possible to create multiple LexoRank fields to manage the backlog. In case there a decision to remove those additional Rank fields, the steps below can be followed.
It's possible to skip straight to points 5 & 6, 1 - 4 are there to identify any filters that may be using the rank field that's going to be deleted.
Alwaysyour data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Run the following SQL to list down all Rank custom field:
SELECT id, cfname from customfield WHERE customfieldtypekey = 'com.pyxis.greenhopper.jira:gh-lexo-rank';
This will return results such as:
id | cfname -------+-------- 10004 | Rank 10005 | Rank1 (2 row)
Run the following SQL to identify the default Rank custom field:
SELECT propertyvalue FROM propertyentry LEFT JOIN propertynumber ON propertyentry.ID = propertynumber.ID WHERE property_key = 'GreenHopper.LexoRank.Default.customfield.id';
This returns the below, which verifies that the
Rank1custom field is not the default.
propertyvalue --------------- 10004 (1 row)
Run the following SQL to identify existing filters using the duplicated rank field (in this case, Rank1). Remember to replace
Rank1with the appropriate Custom Field Name and
10005with the id from step 1.
SELECT id, filtername, authorname FROM searchrequest WHERE reqcontent LIKE '%Rank1%' OR reqcontent like '%cf%';
- Inform the user (authorname) to update their existing filter to use the default Rank field.
Unlock the rank custom field, as per How to unlock a Locked field .
Delete the rank custom field by navigating through (
Administration > Issues > Custom Fields) .