Ali Sadik Kumlali
Ali Sadik Kumlali

Reputation: 651

Deleting issues in Gogs

There is currently no way to delete issues in Gogs: Ability to delete an issue #2050.

Is there a workaround for it?

Upvotes: 0

Views: 421

Answers (1)

Ali Sadik Kumlali
Ali Sadik Kumlali

Reputation: 651

As a workaround, I used following SQLs to delete an issue (for example issue #19) and all releated data on SQLite. (Gogs Version: 0.11.4.0405)

-- Delete issue-user records releated with issue #19
DELETE FROM issue_user WHERE issue_id IN (SELECT id FROM issue WHERE [index] = 19);

-- Decrease number of issues value of repository on which issue #19 has been created
UPDATE repository SET num_issues = num_issues - 1 WHERE id IN (SELECT repo_id FROM issue WHERE [index] = 19);

-- Delete action records added while issue #19 has been created
-- op_type 6 is ACTION_CREATE_ISSUE: https://github.com/gogits/gogs/blob/master/models/action.go
DELETE FROM action WHERE (op_type = 6) AND (repo_id IN (SELECT repo_id FROM issue WHERE [index] = 19)) AND (content LIKE '19|%');

-- At last, delete issue #19
DELETE FROM issue WHERE [index] = 19;

Upvotes: 1

Related Questions