Upgrading to JIRA 6.1 Fails Due To Duplicate Project Keys
When upgrading to JIRA 6.1 or later process stops and the following appears in the
INFO [atlassian.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Create table tracking historical Project keys ... ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ProjectKey]... (SQL Exception while executing the following:INSERT INTO PUBLIC.project_key (ID, PROJECT_ID, PROJECT_KEY) VALUES (?, ?, ?) (Violation of unique index: IDX_ALL_PROJECT_KEYS in statement [INSERT INTO PUBLIC.project_key (ID, PROJECT_ID, PROJECT_KEY) VALUES (?, ?, ?)]))
There is more than one project in PROJECT table with the same project key. Following sql will return list of offending project keys.
SELECT pkey, COUNT(*) FROM project GROUP BY pkey HAVING COUNT(*) > 1;
Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.
Find offending projects. You can use following sql to find those projects. Replace TEST with duplicated project key.
SELECT * FROM project WHERE pkey = 'TEST';
- Resolve key conflicts. You can either remove unused project or change one of project keys.
- Repeat steps 2-3 for all duplicated keys.