Feature #12521
closedImprove tracker deletion error message to display projects containing issues under the tracker
0%
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
Updated by mr gosh about 6 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.
Updated by Marius BĂLTEANU almost 6 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.
Updated by mr gosh almost 6 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. ;)
Updated by Marius BĂLTEANU almost 6 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?
Updated by Marius BĂLTEANU almost 6 years ago
- Category changed from Issues filter to Administration
Updated by Go MAEDA 10 months ago
- File 12521.patch 12521.patch added
- File clipboard-202402011612-0szhs.png clipboard-202402011612-0szhs.png added
- File clipboard-202402011614-wa20u.png clipboard-202402011614-wa20u.png added
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.
Updated by Marius BĂLTEANU 10 months 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.
Updated by Go MAEDA 10 months ago
- File 12521-v2.patch 12521-v2.patch added
Marius BĂLTEANU wrote in #note-7:
I think the patch has an error
projects = Project.joins(:issues).where(issues: { tracker_id: 1 }).distinct
becausetracker_id
is hardcoded to 1.
Sorry, I made a trivial mistake. Here is an updated patch with a test.
Updated by Holger Just 6 months ago
The patch in 12521-v2.patch looks fine to me, thanks!
I'd just propose to update the generated project links to set the status_id filter to "all" so that even closed issues are displayed there. This could look like:
# ...
view_context.link_to(p, project_issues_path(p, set_filter: 1, tracker_id: @tracker.id, status_id: '*'))
# ...
Updated by Go MAEDA about 1 month ago
- File 12521-v3.patch 12521-v3.patch added
Holger Just wrote in #note-11:
I'd just propose to update the generated project links to set the status_id filter to "all" so that even closed issues are displayed there. This could look like:
[...]
Thank you for checking the patch, I have changed the code accordingly.
Updated by Go MAEDA 18 days ago
- Subject changed from Tracker can not be deleted - because issues of archived projects cannot be found without unarchiving the projects to Improve tracker deletion error message to display projects containing issues under the tracker
- Status changed from Reopened to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed