Delete an Bug?

Submitted by muralibab on 2009-10-21

How to delete an particular issue? have provision to delete folder.

Thanks in advance!
Have A Nice Day
Murali.M

I've a workaround to "delete" issues
I was looking to this because even if I flag an issue with the status 'deleted' it will still appear in the view by default as there is no filters possible in this view.

The workaround is the following :
Create a folder named 'trash' with the same type as your folder where you want to delete issues from
Then create the following trigger in the db (works at least with MS SQL, don't know in MySQL) :
In this example : folder 20 is the main folder. folder 21 is the trash folder. Attr_id 12 is the status

CREATE TRIGGER [UPDATE_DELETE]
ON [dbo].[attr_values] 
FOR UPDATE
AS
DECLARE
	@ISSUE_ID				varchar(30),
	@ATTR_ID				varchar(30),
	@ATTR_VALUE				varchar(50),
	@FOLDER_ID				varchar(30)

 BEGIN

SELECT @ISSUE_ID=I.ISSUE_ID, @ATTR_ID=I.ATTR_ID, @ATTR_VALUE=I.ATTR_VALUE, @FOLDER_ID=ISSUES.FOLDER_ID
FROM INSERTED I JOIN ISSUES WITH (nolock) ON I.ISSUE_ID=ISSUES.ISSUE_ID


	IF @FOLDER_ID='20'  --for example if you want to have this functionnality only for the folder 20
	BEGIN

		IF @ATTR_ID='12' AND @ATTR_VALUE='Delete' --the attr_id 12 is the one where you change the status in order to mark it as to delete.
		BEGIN
			UPDATE ISSUES SET FOLDER_ID='21' WHERE ISSUE_ID=@ISSUE_ID --Folder 21 is the trash folder, containing the same type than the main folder
		END

	END

END	-- End Trigger

When the status will change from anything to "Delete" the issue will be moved into the trash folder.
If you want to permanently remove the issue, you can also replace the statement UPDATE ISSUES SET FOLDER_ID='21' WHERE ISSUE_ID=@ISSUE_ID by the following :

DELETE FROM ATTR_VALUES WHERE ISSUE_ID=@ISSUE_ID
DELETE FROM CHANGES WHERE ISSUE_ID=@ISSUE_ID
DELETE FROM ISSUE_STATES WHERE ISSUE_ID=@ISSUE_ID
DELETE FROM COMMENTS WHERE ISSUE_ID=@ISSUE_ID
DELETE FROM FILES WHERE ISSUE_ID=@ISSUE_ID
DELETE FROM ISSUES WHERE ISSUE_ID=@ISSUE_ID

Tested on 1.0-alpha3
In the portable client, you will have to manually remove the cache in order to make it disappear.