This article outlines the steps on how to purge/delete old email attachments, including the steps on how to retrieve deleted attachments in FogBugz.
This process is only defined for the following environments:
FogBugz For Your Server
Note: If you need to delete multiple attachments on your On-Demand account, please send an inquiry to our Success Team to get a quote.
Always create a backup of your database before directly deleting email attachments.
Before deleting from your production database, set up a test instance of FogBugz (if possible), where you can run your database backup.
The following examples show how to delete all email attachments that are older than six months. To delete old FogBugz email attachments from the database, execute the database query below:
Note: Before running the query, please ensure that you are using FogBugz version 8 or later.
Retrieving Deleted Attachments
If you need to retrieve the deleted attachments for a specific bug:
Run the query below. To revisit a particular case, replace
CASE_IDwith the id of the bug containing the attachments you are trying to recover:
UPDATE BugEvent SET fHTML = 0 WHERE ixBug = CASE_ID
To completely delete the attachment, clear the email event as well.
Note: Delete the email event only if you don't need the body of the email, including its attachments.
Use the following query to get the top 100 cases with the largest size:
SELECT TOP 100 DATALENGTH(s) FROM BugEvent ORDER BY DATALENGTH(s) DESC
Use the following query to retrieve cases based on a file size limit, where you have to indicate the size of the case (including attachments) in bytes:
UPDATE BugEvent SET s = '' HAVING DATALENGTH(s) > 10000000