List of (Un)Archived Projects from Database in Jira Datacenter/Server
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Purpose
As of Jira 7.10+, Data Center introduced the ability to archive projects. This article shows how you can identify archived and unarchived projects via a database SQL query.
Solution
SQL Query for getting a list of archived projects:
SELECT pe.property_key,p.* FROM propertyentry pe
JOIN project p on pe.entity_id=p.id
WHERE property_key = 'jira.archiving.projects';
Example Results:
jira7135=# select pe.property_key,p.* from propertyentry pe join project p on pe.entity_id=p.id where property_key = 'jira.archiving.projects';
property_key | id | pname | url | lead | description | pkey | pcounter | assigneetype | avatar | originalkey | projecttype
-------------------------+-------+------------+-----+-------+-------------+-----------+----------+--------------+--------+-------------+-------------
jira.archiving.projects | 10001 | archive me | | admin | | ARCHIVEME | 1 | 3 | 10324 | ARCHIVEME | business
jira.archiving.projects | 10100 | archiveme | | admin | | ARCME | 1 | 3 | 10324 | ARCME | business
(2 rows)
To only get the projects, that are not archived you can use the following SQL query
SELECT * FROM project p
WHERE
p.id NOT IN (select entity_id from propertyentry where property_key = 'jira.archiving.projects');
SQL Query for getting a timestamp of archived projects:
jira533=# select p.pname,pd.propertyvalue from propertyentry pe, propertydate pd, project p where pe.property_key = 'jira.archiving.projects.date' and pe.entity_id=p.id and pe.id=pd.id;
pname | propertyvalue
------------------------+-------------------------------
Validating New project | 2024-01-04 14:53:27.225+05:30
New Task | 2024-01-12 20:03:29.869+05:30