Re-using keys

Deleted user January 14, 2020

I have project ABC with key ABC.  My users would like to retain the info in this project, but have a new project by that name and with that key.  I renamed the project to ABC-OLD and renamed the key ABCOLD on the details page.  This worked fine; the key shows as ABCOLD-1 and would allow viewing the original data.

However, if I try to create a new ABC project, it tells me key ABC is currently in use by project ABC-OLD.  I viewed the project and could query by key ABCOLD.  However, if I queried with ABC-1 (without OLD), it showed me ABCOLD-1.

The original project has types and schemes that are no longer valid, but the user is clear they want to keep the project name and key id for the new project, but built with different issue types and workflows.  Since renaming the key didn't eliminate the original link, are there any other options?  I thought about creating the "OLD" project and then having a bulk move of data, but it was a complicated project that would be ugly to re-create.  

I'm open to any ideas!  Thanks in advance.

 

4 answers

2 accepted

1 vote
Answer accepted
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.
January 14, 2020

This happens so that the old key remains searchable when people have external issue links.  In your example, the link to http://yourjira/browse/ABC-1 and ABCOLD-1 will both take them to the underlying issue.

If you have database access, and a steady hand (I never recommend messing with a Jira database, but this one is a little safer than most) you can destroy this and enable re-use of keys.  If you do this, the link to ABC-1 will stop working, so you need to think carefully before destroying it (the key change will persist in the history, but you won't be able to search any more, and you may get some "interesting" questions from people about why their links now point at utter rubbish)

Stop Jira.  Remove the old project from the project table, and remove all the lines in moved_issue_key that reference it as well.  Restart Jira and re-index it immediately.  Also, you will need to re-index Confluence if you have that linked to Jira, and you may have problems with Bitbucket, FeCru and Bamboo if you linked them as well (these, you may have to live with, unless you want to start editing commit messages and build history)

1 vote
Answer accepted
Pete Singleton
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.
January 14, 2020

This is by design, so that users can still query using the old key.  You can't resuse the project key after renaming.  See here: https://confluence.atlassian.com/adminjiraserver/editing-a-project-key-938847080.html

Specifically:

Notes for change management

While editing the project key is a major change, in most cases, your Jira project will work as you'd expect with a new key. There are a few cases that you should be aware of, which are listed below. We recommend reviewing these and advising your users accordingly.

  • The old project key can be used in JQL queries — Users won't have to update issue filters that reference the old project key.
  • If you use Confluence with Jira, the Jira issue macros in Confluence will continue to work. Please note, if you don't see the change straight away, allow some time for the cache to refresh.
  • 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.
Deleted user June 22, 2020

I deleted the old project and Jira still reports that the old project key is being used.

Like Amos likes this
0 votes
Tom Lister April 16, 2020

I have renamed some keys for empty projects and want to remove the old keys for reuse

Do you know which tables they are stored in? Looks like its the original key field in the project table

I don't need to preserve any old issue lookups - at least none I'm not prepared to deal with.

Can I clear moved_issue_keys table and original_key column and reindex?

There are also entries in project_key for old and new. 

Tom

Tom Lister April 16, 2020

I'm thinking these are the keys I have changed


select pkey, originalkey from public.project where pkey != originalkey

These are the keys to remove

delete from project_keys where project_key in (select originalkey from public.project where pkey != originalkey);

 update project set original_key = pkey;

delete from FROM public.moved_issue_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.
April 16, 2020

Yes, those are the two tables I was thinking of (15 years and I still haven't quite memorised the database table names)

Tom Lister April 17, 2020
Sabine Van Regenmortel September 13, 2023

And what about the attachment folder? As far as I test, it remains the original 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.
September 14, 2023

Welcome to the Atlassian Community!

Yes, but it will be empty as you've deleted or moved all the issues with the old key, so Jira will just reuse it, rather than having to create it new when you first add an attachment to your new project.

Sabine Van Regenmortel September 14, 2023

Thank you for your reply!

Oh I did not test that.  Good to know.

I just tested the renaming of a project, but not rename - delete - create project with old key.

For existing renamed projects, I:

- deleted the old key folder
- created an attachment folder with the new key
- created a new issue with attachment with obviously the new key
- still it re-created an old key folder with this new attachment

I find this rather confusing.
I put empty folders with the new key pointing to the old key folder in the attachment folder just to make sure.

image.png

0 votes
Deleted user January 14, 2020

Thank you both for the fast response.  It makes sense.

It looks like I'll be telling the customer they have to have key ABCD since I don't want to manually manipulate the database.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events