Can not create jira project with old edited project key

Fahad V A June 9, 2014

Hi,

I created a Jira project with a key earlier and later edited the project key. But later when i tries to create a new Jira project with the old project key which was edited and changed I get an error message Project 'ABC' uses this project key.

Is there any solution for this I need to create the new project with the key.

6 answers

12 votes
Pawel Niewiadomski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2014

If you really want that you need to clear the old key from project_key table.

We intentionally didn't allow that because then you will break any links from within JIRA or from the outside to issues mentioned under the old key.

If you're afraid of messing with the database (or you can't) you can do another trick - create a new, temporary project (name and key doesn't matter), move issues to that project, remove the original project which will remove also all old keys for it. Then create a project with the key it should have and move back all those issues. Delete the temporary project. Now you're able to create a new project with the key you want.

3 votes
Orzech
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 9, 2014

Hi, according to this document: https://confluence.atlassian.com/display/JIRA/Editing+a+Project+Key

"You won't be able to create a new project with the old project key. However, you can change the renamed project back to the old project key. If you delete the project, all associated keys will be freed and you'll be able to re-use them."

So old keys are still "assigned" to project (because of filters etc.). Currently you can't create new project with the key that was already used.

Christopher Mohr November 26, 2014

Hello Michal, is it possible to delete old keys complete from the database and replace them with the new key? Or are new keys just "renaming" the old keys and the internal tracking is still based on the old keys? I am asking this regarding a project import where an old key is colliding with an exisiting key in the new jira instance. Are there options to import this project at all? Cheers, Chris

Orzech
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 30, 2014

Hi Chris, Please see Pawel's answer in this thread. Cheers, Michal

2 votes
Leonard Chew
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2018

EDITED COMMENT
This only worked, because the Project was renamed soon after its creation, so that no edited fields, links or moved items existed under the old project name.

Use Pawels trick with the temporary project to be on the safe side to avoid meddling with the DB.

Hi there

I had the same need and tested Pawels suggestion, which worked.

Database: Oracle 12.1
JIRA: 7.7.1

Here is a step-by-step description:

1) Log into your database and delete the record from the project_key table

-- sql script to delete old project name, so that it can be reused in a new project:
delete
from project_key pk
where project_key = 'MYOLDKEY' -- replace this with your own project key
and (select count(*) from project where pkey = pk.project_key) = 0; -- security check: you don't want to delete the currently active project name


-- commit, if exactly one record was deleted:
commit;

 -> this should delete one record exactly, or else you have a mistake in your logic.

2) Restart your Server
-> Note: Reindexing your project doesn't work, as the project key index is not updated in that task.

3) Create your new project in JIRA using the previously deleted project key.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2018

ARGH NO!

You forgot that you must have Jira off line when you do this, and you have only doen part of the job - you've missed the other table you need to change.

Leonard Chew
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

Thank you! - I gather you are speaking of the table "changeitem"?

Yes, if you had moved or edited certain item content at the time where the old project-key was active, then you would probably need to edit the records to the new key there.
That didn't apply for us however, because we did the project renaming very soon after creating the project.

I guess the affected items would be:

select * from changeitem
where oldstring like 'MYOLDKEY-%'
or newstring like 'MYOLDKEY-%';

And that still leaves possible links in description and comments open.

In the end Pawels trick with the temporary project is the best solution.

I will edit my original comment as not to mislead other people.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 12, 2018

Nope, there are other tables involved here.

AURA, s.r.o. June 9, 2018

Restart is not needed, when you will add new project. Table of project keys will be reloaded.

1 vote
Jerome F_ August 14, 2019

I can't believe how many pebbles like this there's in JIRA.... I mean for the price we pay it really shouldn't be THAT MESSY !!

0 votes
Orzech
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 9, 2014

Yes you will be able to do that, however you will need to create projects manually before importing them. Please make sure you backup your data before changing anything on your instance.

0 votes
Fahad V A June 9, 2014

So once delete the old project, and create the new project with the key and then from the using project import, I can use both the old and new project.

Am I correct?

Suggest an answer

Log in or Sign up to answer