how to find which projects use a custom field?

Added by Mark Harre almost 5 years ago

In Administration / Custom fields i can see that my custom field is used by 1 project but I can't find which project. I have looked through each project one at a time but i just can't seem to find it. Any way to look this up? Perhaps someone familiar with the database table structure could help with a simple select query.

Thx Mark

ps using Redmine v2.1.2 on Ubuntu

Replies (3)

RE: how to find which projects use a custom field? - Added by Jan Niggemann (redmine.org team member) almost 5 years ago

I'm using 1.4.3 and I don't know if this changed but give it a try:

SELECT c.name FROM redmine.custom_fields a
INNER JOIN redmine.custom_values b ON a.id=b.custom_field_id
INNER JOIN redmine.projects c ON b.customized_id=c.id
WHERE a.name='TEST'

Replace TEST on the last line with the name of the field your're looking for.

RE: how to find which projects use a custom field? - Added by Mark Harre almost 5 years ago

thx Jan

This put me on the right track
I had to join on the custom_fields_projects table rather than custom_values table (at least in this version):

SELECT c.name FROM redmine.custom_fields a
INNER JOIN redmine.custom_fields_projects b ON a.id=b.custom_field_id
INNER JOIN redmine.projects c ON b.project_id=c.id
WHERE a.name='TEST';

regards,
Mark

RE: how to find which projects use a custom field? - Added by Jan Niggemann (redmine.org team member) almost 5 years ago

NP :-)
For reference:
The table custom_fields_projects also exists in 1.4.3 but it's empty.

(1-3/3)