How to Delete roles used in a deleted project ?
Added by Antoine Sauteron almost 2 years ago
Redmine 4.2.1.stable
Ruby version 2.7.2-p137 (2020-10-01) [x86_64-linux]
Rails version 5.2.5
Dear all,
We are facing an issue where a role cannot be deleted because it is being used... In a deleted project.
This statement :
SELECT users.id "User ID", users.login, role_id, redmine.roles.name "role name", project_id
FROM redmine.member_roles
JOIN redmine.roles on redmine.member_roles.role_id = redmine.roles.id
JOIN redmine.members on redmine.members.id = redmine.member_roles.member_id
JOIN redmine.users ON members.user_id = users.id
WHERE role_id = 3;
Returns projects 35,42 and 44. But these projects don't exist in table projects.
I see 2 options there =
1 - Clean orphaned data in table member_roles, then delete the role from the GUI.
DELETE FROM redmine.member_roles WHERE role_id = 3;
With this solution, I'm afraid that some orphaned data will be forgotten.
- OR -
2 - Add projects with an INSERT in the DB. But I'm a bit confused with columns lft and rgt, not sure what they are used for and how their values are generated.
Any suggestions ?
Antoine