Project

General

Profile

Actions

Feature #12521

open

Tracker can not be deleted - because issues of archived projects cannot be found without unarchiving the projects

Added by Walter Seethaler about 11 years ago. Updated 18 days ago.

Status:
Reopened
Priority:
Normal
Assignee:
-
Category:
Administration
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Redmine: 1.3.3.stable.9519 (MySQL)
MySQL: 5.0.51a-24+lenny5
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
rails (2.3.14, 2.3.11)

As a feature, it is not possible to delete the Trackers, of existing issues.

But even after deletion of all related issues of a tracker (in all open and archived projects), it is (sometimes) not possible to delete trackers. This is because when a project is deleted, its issues stay in the database.

A look in the Database:
- when a project is deleted of table: projects
- it's assigned issues stay in table: issues
- eg. issue 2545 has a foreign key, pointing to project 12, which was deleted
- those tickets stay around forever and can not be delete from the UI

Thus, the Tracker of issue 2545, can never be deleted, because of the "zombie" ticket.

DB-Topics: on delete cascade, referential integrity constraint

In addition, when an adminitrator trys to accesses the ticket (/issues/2545), he gets the weird message: 403 - not enough rights. Weird, because an admin has all rights. A better message would help to find bugs faster, especially if this bugs also applies to: versions, documents and so on.

By the way. Redmine is great, thx for your work.


Files

12521.patch (1.76 KB) 12521.patch Go MAEDA, 2024-02-01 08:06
clipboard-202402011612-0szhs.png (113 KB) clipboard-202402011612-0szhs.png Go MAEDA, 2024-02-01 08:12
clipboard-202402011614-wa20u.png (56.9 KB) clipboard-202402011614-wa20u.png Go MAEDA, 2024-02-01 08:14
12521-v2.patch (2.8 KB) 12521-v2.patch Go MAEDA, 2024-02-02 06:39
Actions #1

Updated by mr gosh over 5 years ago

This Problem is still present and affects me too.
There should be a bossibility to move all tickets with the affected tracker to another tracker or a NULL?
At least during deletion of the tracker itself.

Actions #2

Updated by Marius BĂLTEANU about 5 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

When you delete a project, all the related data is deleted.

mysql> select * from issues where project_id = 3;
+----+------------+------------+---------------------------------+-------------------------------------------------+----------+-------------+-----------+----------------+-------------+------------------+-----------+--------------+---------------------+---------------------+------------+------------+-----------------+-----------+---------+------+------+------------+-----------+
| id | tracker_id | project_id | subject                         | description                                     | due_date | category_id | status_id | assigned_to_id | priority_id | fixed_version_id | author_id | lock_version | created_on          | updated_on          | start_date | done_ratio | estimated_hours | parent_id | root_id | lft  | rgt  | is_private | closed_on |
+----+------------+------------+---------------------------------+-------------------------------------------------+----------+-------------+-----------+----------------+-------------+------------------+-----------+--------------+---------------------+---------------------+------------+------------+-----------------+-----------+---------+------+------+------------+-----------+
|  5 |          1 |          3 | Subproject issue                | This is an issue on a cookbook subproject       | NULL     |        NULL |         1 |           NULL |           4 |             NULL |         2 |            0 | 2018-12-19 18:54:11 | 2018-12-22 18:54:11 | NULL       |          0 |            NULL |      NULL |       5 |    1 |    2 |          0 | NULL      |
| 13 |          1 |          3 | Subproject issue two            | This is a second issue on a cookbook subproject | NULL     |        NULL |         1 |           NULL |           4 |             NULL |         2 |            0 | 2018-12-19 18:54:11 | 2018-12-22 18:54:11 | NULL       |          0 |            NULL |      NULL |      13 |    1 |    2 |          0 | NULL      |
| 14 |          1 |          3 | Private issue on public project | This is a private issue                         | NULL     |        NULL |         1 |           NULL |           5 |             NULL |         2 |            0 | 2018-12-09 18:54:11 | 2018-12-09 18:54:11 | NULL       |          0 |            NULL |      NULL |      14 |    1 |    2 |          1 | NULL      |
| 15 |          3 |          3 | Private issue on public project | This is a private issue                         | NULL     |        NULL |         2 |           NULL |           5 |             NULL |         1 |            0 | 2019-01-10 03:20:53 | 2019-01-10 03:20:53 | 2019-01-10 |          0 |            NULL |      NULL |      15 |    1 |    2 |          1 | NULL      |
+----+------------+------------+---------------------------------+-------------------------------------------------+----------+-------------+-----------+----------------+-------------+------------------+-----------+--------------+---------------------+---------------------+------------+------------+-----------------+-----------+---------+------+------+------------+-----------+
4 rows in set (0.00 sec)

Deleted the project with id 3 from UI, Administration -> Projects

mysql> select * from issues where project_id = 3;
Empty set (0.00 sec)

mr gosh wrote:

There should be a bossibility to move all tickets with the affected tracker to another tracker or a NULL?
At least during deletion of the tracker itself.

You already have this possibility, you can open the Issue global page, filter issues only by the tracker that you want to delete and using bulk edit, change tracker type to another.

Actions #3

Updated by mr gosh about 5 years ago

Marius BALTEANU wrote:

You already have this possibility, you can open the Issue global page, filter issues only by the tracker that you want to delete and using bulk edit, change tracker type to another.

You're right - but this is not possible if you have closed or archived projects - but this can be achieved by re-opening these projects - perhaps we reconsider our "projects don't get deleted" philosophy at this point. ;)

Actions #4

Updated by Marius BĂLTEANU about 5 years ago

  • Tracker changed from Defect to Feature
  • Subject changed from Tracker can not be deleted - because issues of deleted projects stay in the database to Tracker can not be deleted - because issues of archived projects cannot be found without unarchiving the projects
  • Category changed from Database to Issues filter
  • Status changed from Closed to Reopened
  • Resolution deleted (Invalid)

mr gosh wrote:

You're right - but this is not possible if you have closed or archived projects - but this can be achieved by re-opening these projects - perhaps we reconsider our "projects don't get deleted" philosophy at this point. ;)

It is possible when you have closed projects because you can filter issues by "Project's status" (feature available in Redmine 4.0.0, please see #20081), but indeed, for archived projects, you can't and on instances with a lot of archived projects, it could be quite a challenge.

I'm reopening this ticket as s Feature, maybe we can find a solution to help users delete trackers used by issues from archived projects. As a first idea, what do you think if we add to the error message the archived projects that have issues with that tracker?

Actions #5

Updated by Marius BĂLTEANU about 5 years ago

  • Category changed from Issues filter to Administration
Actions #6

Updated by Go MAEDA 24 days ago

Marius BĂLTEANU wrote in #note-4:

I'm reopening this ticket as s Feature, maybe we can find a solution to help users delete trackers used by issues from archived projects. As a first idea, what do you think if we add to the error message the archived projects that have issues with that tracker?

The attached patch 12521.patch implements similar feature. When tracker cannot be deleted, it displays links to all projects including archived ones which have issues with the tracker.

Althgouh an error page is displayed if you click a link to an archived project, you can unarchive the project by clicking a button in the error page.

Actions #7

Updated by Marius BĂLTEANU 23 days ago

I think the patch has an error projects = Project.joins(:issues).where(issues: { tracker_id: 1 }).distinct because tracker_id is hardcoded to 1.

Actions #8

Updated by Go MAEDA 23 days ago

Marius BĂLTEANU wrote in #note-7:

I think the patch has an error projects = Project.joins(:issues).where(issues: { tracker_id: 1 }).distinct because tracker_id is hardcoded to 1.

Sorry, I made a trivial mistake. Here is an updated patch with a test.

Actions #9

Updated by Go MAEDA 18 days ago

  • Target version set to Candidate for next major release
Actions

Also available in: Atom PDF