How to reset the project counter after moving issues
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
After moving issues from project A to B (e.g. moving A-1 and A-2 issues from A to B) the issue keys moved from project A cannot be used anymore.
This is an expected behavior. When an issue is moved JIRA retains the old issue key as reference. This happens because the old issue links continue to work (confluence links to the old issue, links send to customers and so on will continue to work).
Please note that after executing the steps below the old links (created before moving the issues) will be unavailable or pointing to the new issues with the same moved issue keys. This is very important change, since it can create a lot of confusing to users that already have links to the moved issues.
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.
Modifying data directly in JIRA's database is out of scope for Atlassian Support. These instructions are to help provide guidance if these changes are absolutely needed.
To reset the project count you need to execute the following two steps (please substitute A in the below queries for your project key):
Reset the pcounter field from project table
UPDATE project SET pcounter=0 WHERE pkey='A';
Remove the rows referencing the old issue keys from moved_issue_key
DELETE FROM moved_issue_key WHERE old_issue_key like 'A-%';
After the above steps you should be capable to create issues starting from the number that was set in the pcounter field.