Batch add users to the cc list for all components in the bugzilla database directly

Posted in apps , database

bugs-on-a-leafBatch adding users to the cc list for multiple components can take forever, and it’s a lot of click click click click click, which I despise.

If you want to add a user to all of the components in bugzilla, you don’t have to go through the gui. In fact, you can change just about anything in bugzilla by connecting to the database directly and modifying the tables. I find this much faster than repetitively navigating through the web front end.

I just updated 50+ components and it took me 2 minutes to do. But if I’m just updating a component or two, I wouldn’t fiddle with the database directly. It’s just not worth the hassle since you could do it in the same amount of time from the front end.

Connect to the database

$ psql -d bugzilla

Find the user’s userid that you’re looking for in the profiles table

bugzilla=# select userid, login_name from profiles order by user_id;

userid login_name
1 admin@domain.com
6 fnamelname@domain.com
18 dilbert@domain.com
19 coverity@domain.com

Find the components for which you would like to add people to the cc list

bugzilla=# select id, name from components order by name;

id name
7 Widget
14 Dohicky
21 Thing-a-ma-bob

You can add the dilbert user, whose id is 18, to all the components in one swoop

bugzilla=# insert into component_cc
select distinct 18, select distinct component_id from component_cc);

Or you can change the select to match whatever you want. Until I tried it, I didn’t know you could hold one value constant like that while selecting a distinct range like that. I thought that was pretty neat!

Posted by admica   @   24 November 2009

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« Enable ethernet bridging through your firewall using iptables or sysctl.conf
Next Post
Building qpidc AMQP C++ libraries on ppc »
Powered by Wordpress   |   Lunated designed by ZenVerse