Open Bug 119569 Opened 23 years ago Updated 9 years ago

Need ability to move component from product to product

Categories

(Bugzilla :: Administration, task, P2)

2.15

Tracking

()

People

(Reporter: caillon, Unassigned)

References

Details

(Whiteboard: [wanted-bmo])

Remember moving all those closed bugs when Bugzilla got it's new product?

If there was a way to move them in the admin panel, that would be alleviated. 
Webtools -> Bugzilla could have become Bugzilla -> Bugzilla-General and then
there would have been way less moving of bugs.
Priority: -- → P4
Target Milestone: --- → Future
Reassigning all of my "future" targetted bugs to indicate that I'm not presently
working on them, and someone else could feel free to work on them.
Reassigning all of my "future" targetted bugs to indicate that I'm not presently
working on them, and someone else could feel free to work on them. (sorry for
the spam if you got this twice, it didn't take right the first time)
Assignee: justdave → nobody
QA Contact: mattyt-bugzilla → default-qa
Assignee: nobody → justdave
Priority: P4 → P1
Target Milestone: Future → ---
Depends on: bz-process_bug
OS: Linux → All
Hardware: PC → All
pulling from old email, here's what Myk did last time we did this in any major capacity a long time ago...  Schema may be outdated.  I think we were 2.17.4 at the time, but I'm not positive.

----8<----

I did more component moves today.  Here's what I did:

> Can you move these components from "Core" to "Other Applications" please?
>
> Chatzilla
> Dom Inspector
> Javascript Debugger

mysql> select id, name  from components where name IN ('Chatzilla', 'DOM 
Inspector', 'Javascript Debugger');
+-----+---------------------+
| id  | name                |
+-----+---------------------+
| 109 | ChatZilla           |
|  59 | DOM Inspector       |
|  22 | JavaScript Debugger |
+-----+---------------------+
3 rows in set (0.00 sec)

mysql> select id, name from products where name = 'Core';
+----+------+
| id | name |
+----+------+
|  1 | Core |
+----+------+
1 row in set (0.00 sec)

mysql> select id, name from products where name = 'Other Applications';
+----+--------------------+
| id | name               |
+----+--------------------+
| 28 | Other Applications |
+----+--------------------+
1 row in set (0.00 sec)

INSERT INTO milestones(value, sortkey, product_id) SELECT m1.value, 
m1.sortkey, 28 FROM milestones m1 LEFT JOIN milestones m2 ON m1.value = 
m2.value AND m2.product_id = 28 WHERE m1.product_id = 1 AND m2.value IS 
NULL;
INSERT INTO versions(value, product_id) SELECT v1.value, 28 FROM 
versions v1 LEFT JOIN versions v2 ON v1.value = v2.value AND 
v2.product_id = 28 WHERE v1.product_id = 1 AND v2.value IS NULL;
LOCK TABLES bugs WRITE, bugs_activity WRITE, components WRITE;
UPDATE components SET product_id = 28 WHERE id IN (109, 59, 22);
UPDATE bugs SET product_id = 28 WHERE component_id IN (109, 59, 22);
INSERT INTO bugs_activity(bug_id, who, bug_when, fieldid, removed, 
added) SELECT bug_id, 27300, delta_ts, 25, "Core", "Other Applications" 
FROM bugs WHERE component_id IN (109, 59, 22);
UPDATE bugs SET delta_ts = delta_ts, lastdiffed = NOW() WHERE 
component_id IN (109, 59, 22);
UNLOCK TABLES;


> From "Core" to "Mozilla Application Suite":
>
> XP Apps
> XP Apps: Autocomplete
> XP Apps: GUI Features

mysql> select id, name from components where name IN ('XP Apps', 'XP 
Apps: Autocomplete', 'XP Apps: GUI Features');
+-----+-----------------------+
| id  | name                  |
+-----+-----------------------+
|  51 | XP Apps               |
| 212 | XP Apps: Autocomplete |
| 167 | XP Apps: GUI Features |
+-----+-----------------------+
3 rows in set (0.00 sec)

mysql> select id, name from products where name = 'Core';
+----+------+
| id | name |
+----+------+
|  1 | Core |
+----+------+
1 row in set (0.00 sec)

mysql> select id, name from products where name = 'Mozilla Application 
Suite';
+----+---------------------------+
| id | name                      |
+----+---------------------------+
| 25 | Mozilla Application Suite |
+----+---------------------------+
1 row in set (0.00 sec)

INSERT INTO milestones(value, sortkey, product_id) SELECT m1.value, 
m1.sortkey, 25 FROM milestones m1 LEFT JOIN milestones m2 ON m1.value = 
m2.value AND m2.product_id = 25 WHERE m1.product_id = 1 AND m2.value IS 
NULL;
INSERT INTO versions(value, product_id) SELECT v1.value, 25 FROM 
versions v1 LEFT JOIN versions v2 ON v1.value = v2.value AND 
v2.product_id = 25 WHERE v1.product_id = 1 AND v2.value IS NULL;
LOCK TABLES bugs WRITE, bugs_activity WRITE, components WRITE;
UPDATE components SET product_id = 25 WHERE id IN (51, 212, 167);
UPDATE bugs SET product_id = 25 WHERE component_id IN (51, 212, 167);
INSERT INTO bugs_activity(bug_id, who, bug_when, fieldid, removed, 
added) SELECT bug_id, 27300, delta_ts, 25, "Core", "Mozilla Application 
Suite" FROM bugs WHERE component_id IN (51, 212, 167);
UPDATE bugs SET delta_ts = delta_ts, lastdiffed = NOW() WHERE 
component_id IN (51, 212, 167);
UNLOCK TABLES;
Whiteboard: [wanted-bmo]
Blocks: 271978
Keywords: student-project
Re-assigning to nobody so it's clear that this is open for a student to take.  Dave, if you are in fact working on this and I've misunderstood, apologies.
Assignee: justdave → nobody
This is already done, actually.  Except it's in quite hacky form and could use some polish and get intregrated with Bugzilla itself (it's a set of standalone scripts currently)

https://dm-bugstage01.mozilla.org/bmo/3.2/contrib/reorg-tools/

bzr co https://dm-bugstage01.mozilla.org/bmo/3.2 bmo3.2
cd bmo3.2/contrib/reorg-tools
The above scripts make several assumptions that were valid in the specific cases of moves we've already done, but probably won't be valid in general, such as assuming that you would want to clone all of the milestones and versions from the source product to the target product.

A properly integrated version of this would probably provide options for any of:
a) cloning all of them
b) cloning only the ones that were actually in use by bugs in the components
   being moved
c) resetting them all to the defaults from the target product
d) providing some sort of mapping
Assignee: nobody → administration
I think I will have fun with this one...
Assignee: administration → LpSolit
Status: NEW → ASSIGNED
Keywords: student-project
Priority: P1 → --
  This is still a P1 or P2 for the project under the Priority System, although I do understand that it's not a P1 for you right now personally. :-)
Priority: -- → P2
Assignee: LpSolit → administration
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.