How to merge issue link types
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Admins may end up with a lot of duplicate issue links that need to be cleaned up. In many cases, more than one issue link have the same functional/business meaning and need to be merged.
Environment
Any Jira Server/DC installation with write access to the DB.
Solution
Case A) If inward and outward descriptions have the same meaning
This is the easy scenario. For instance, you have two link types called Blocks and Dependency configured as follows:

In this case, proceed with deleting the duplicate link type. You will be prompted to swap it:

Once you confirm the deletion, all existing links using the deleted type will be changed.
Case B) If inward and outward descriptions have opposite meanings
Here's an example:

In this case, you won't be able to simply delete and swap the issue link because if you do so, the logical meaning of links for all issues using the old type will be inverted. i.e.
Before deletion and swap | After deletion and swap |
---|---|
ABC-123 has to be implemented before XYZ-123 | ABC-123 is blocked by XYZ-123 (❌ this is wrong) |
Step B.1) Swap source and destination issues
The source and destination issues using the issue link in question have to be swapped in the DB so that, when the link type is deleted, all previously linked issues would be using the new link meaningfully.
Before running the SQL query, you need to know the ID of the link type you're deleting. To get the ID, hover the Edit link and copy the link type ID from the URL. In the example below, the link type ID is 9999.
Once you have the ID, run the following SQL query:
⚠️ The SQL query below writes data to your DB. Be sure to take a dump of your database before running it.
⚠️ The approach is different in MySQL vs other RDBMSs.
For MySQL
1
UPDATE issuelink SET source=(@temp:=source), source=destination, destination=@temp WHERE linktype = 9999;
For other RDBMS
1
UPDATE issuelink SET source=destination, destination=source WHERE linktype = 9999;
Step B.2) Delete and swap the link type with a new one
Once the source and destination are swapped, proceed with deleting the unwanted issue link type. You will end with the issues using the new link correctly:
Before deletion and swap | After deletion and swap |
---|---|
ABC-123 has to be implemented before XYZ-123 | ABC-123 blocks XYZ-123 |
Was this helpful?