How to Delete Assets Object History Logs in Jira
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Summary
Purpose
Removing an object's history logs through the Assets UI is currently not possible. This issue has been recorded as an area for improvement in Assets: JSDSERVER-8706 - Create a cleanup mechanism to Assets Object History
Until the product improvement is in place, this article aims to provide an alternative method for removing object's history records using database statements.
Environment
All versions of Assets management.
Solution
Before you begin
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Table AO_8542F1_IFJ_OBJ_HIST stores the History values for existing Objects. To review all impacted entries and the database structure for potential adjustments, execute a select query on the object from which you intend to remove history:
You can specify the criteria for the deletion of rows, for example - any History row/entry created before December 31st 2020:
SELECT * FROM "AO_8542F1_IFJ_OBJ_HIST" WHERE "OBJECT_ID" = XXX;
To remove the history logs, you can either delete logs that are older than a specific date or specify an object ID for removal:
You can specify the criteria for the deletion of rows, for example - any History row/entry created before December 31st 2020:
DELETE FROM "AO_8542F1_IFJ_OBJ_HIST" WHERE "CREATED" < '2020-12-31 00:00:00.0';
OR
If you want to delete History per specific Object, where xxx is the Object ID of the object you wish to delete History for:
DELETE FROM "AO_8542F1_IFJ_OBJ_HIST" WHERE "OBJECT_ID" = XXX;
The Object ID is the numeric part of the Object Key, and will also show in the Object URL when you navigate to the Object.
This is tested on PostgreSQL and may need modifying for other DBMS such as Oracle or SQL Server.
Deleting History entries will only remove the History records from the Object, no other part/functionality in Assets should be affected by removing the Object's History.
If you are using PostgreSQL, running the VACUUM FULL command is essential to prevent deleted data from occupying space in the table. This practice is highly recommended, especially when carrying out substantial updates, as detailed in Optimize and Improve PostgreSQL Performance with VACUUM, ANALYZE, and REINDEX.
Starting in JSM 5.7.0, the data in the AO_8542F1_IFJ_OBJ_HIST is referenced by Assets Imports to Manage Objects. Therefore, an import could fail to modify an existing object if there is no history of the import ever modifying the object. Please see: JSDSERVER-7225 - Insight Missing Objects across all import configurations along with Assets Objects are Not Marked as Missing by the Import and also Automatically Delete Objects that are Not Created by Asset Import Tasks for more information
Was this helpful?