Insight - How to delete Object History logs
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Atlassian Support Offerings
The following approaches that involves SQL queries are beyond Atlassian Support Offerings. Please note that Atlassian does not support direct database INSERT, UPDATE or DELETE queries, as they can easily lead to data integrity problems. Atlassian will not be held liable for any errors or other unexpected events resulting from the use of the following SQL queries.
Purpose
Remove Object's History logs is not possible through Insight UI. This is how to perform this action using Database queries.
This has been recorded as an improvement area for Insight:
- JSDSERVER-8706Getting issue details... STATUS
Until the product improvement is in place this Article intends to describe a way of removing Object's History records.
Environment
Insight asset 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 is where all the History values are stored for existing Objects. To verify all of the affected entries, and the database structure for further tweaks, run a select query against the object that you're looking to remove history from:
SELECT * FROM "AO_8542F1_IFJ_OBJ_HIST"
WHERE "OBJECT_ID" = XXX;
To remove the history logs, we have 2 options, one to remove by date older than, or by specifying an object ID:
DELETE FROM "AO_8542F1_IFJ_OBJ_HIST"
WHERE "CREATED" < '2020-12-31 00:00:00.0';
OR
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 Insight should be affected by removing the Object's History