View Issue Details

IDProjectCategoryView StatusLast Update
0008071mantisbtmigrationpublic2012-10-08 05:31
Reportermarc Assigned Todregad  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionno change required 
Product Version1.0.7 
Target VersionFixed in Version 
Summary0008071: Migration script for Bugzilla 2.16 (script by Cris Daniluk)
Description

I rediscovered Cris' script here:
http://web.archive.org/web/*/http://crisdaniluk.com/bugzilla2mantis/bugzilla2mantis.pl

I made some changes, and added the import of attachments. I used it to successfully convert a Bugzilla 2.16.7 installation to Mantis 1.0.7.

Script is attached.

Tagspatch

Relationships

related to 0007469 new bugzilla2mantis.php script 
related to 0009283 closedvboctor "Cris Daniluk " link is not opening 
related to 0008251 closeddregad Migration script to Mantis 

Activities

2007-06-15 12:57

 

bugzilla2mantis.pl (28,256 bytes)

2007-12-12 08:27

 

bugzilla2mantis-2.22.pl (28,382 bytes)
epierre

epierre

2007-12-12 08:27

reporter   ~0016434

I've attached a corrected version for Bugzilla 2.22 which has an attachement table separated from the previous versions

epierre

epierre

2007-12-12 11:41

reporter   ~0016435

there is an issue on severity that should be put to a value, import fails if it is NULL.

a last point to check: utf8 import seems to be faulty... it corrupts data if original base was latin1 with accents, and destionation is latin1 too.

harlan

harlan

2008-06-03 19:32

reporter   ~0018001

I tried the 2.22 script on a bugzilla 2.22 system. The first problem I had was that mantis_project_category_table did not exist. I manually created it.

-- I'm not an SQL guy - how difficult would it be to have the script generate code to automatically add missing tables?

The second problem I had was that the INSERTs for the mantis_bug_table are using a 'category' entry, which does not seem to exist.

illes

illes

2008-09-08 09:40

reporter   ~0019333

Does the script can be used for a Bugzilla 3.0 installation?

2008-10-15 09:48

 

bugzilla2mantis-3.04.pl (29,208 bytes)
veitg

veitg

2008-10-15 10:00

reporter   ~0019565

Hi.

Grabbed bugzilla2mantis-2.22.pl to get it to work with bugzilla 3.04 and mantis 1.1.2. Had to add some fixes to get it running. Here's what I changed (use diff to get the idea - not nice but works for me):

  • excluded bugzilla admin account from migration (mantis default install already has one that leads to conflicts during import (duplicate id (1))).
  • in summary view in mantis, components were listed as IDs after migration - not the names. now names are inserted correctly.
  • date_order of project versions was null when importing. leads to a failure when copying version from proj a to b. now now() is used for that.
  • component leaders were set after migration, but they weren't assigned to the project itself as members. Leads to empty dropdowns on the component details. Now, component owners are always added as project members with the role developer (made sense for us).

Perhaps we missed some things - but it looked well so far. I'll come back if there're any issues left.

BTW: would be great if everything would run in one transaction - so on every err one has to delete the tables manually :(. Perhaps someone needs this:

delete from mantis_project_table;
delete from mantis_user_table where id > 1;
delete from mantis_project_category_table;
delete from mantis_project_version_table;
delete from mantis_bug_text_table;
delete from mantis_bugnote_text_table;
delete from mantis_bugnote_table;
delete from mantis_bug_table;
delete from mantis_bug_history_table;
delete from mantis_bug_file_table;
delete from mantis_project_user_list_table;

Have fun.

Regards,
Veit

phowells

phowells

2009-05-22 08:54

reporter   ~0021882

Last edited: 2009-05-22 09:04

View 2 revisions

I am not a perl person but I have made modifications to the 3.04 script to include custom fields, its tailored to my needs but I feel if someone else looks at it they can do some real data driven sql development. I have attached it called bugzilla2mantis-3.2.3.pl

I have successfully ran this and it does work but it messes up on some of the dates but I believe that has more to do with out bugzilla database having dirty data.

2009-05-22 09:03

 

bugzilla2mantis-3.2.3.pl (32,921 bytes)
phowells

phowells

2009-06-29 16:38

reporter  

bugzilla2mantis-3.2.3_fixed.pl (33,219 bytes)
KarlReichert

KarlReichert

2010-02-03 12:33

reporter   ~0024301

I tried both, v3.04 and v3.2.3_fixed of the perl scripts, but both a throwing the same error (the first one, I guess the following ones are caused by the first one):

C:>perl bugzilla2mantis-3.04.pl
DBD::mysql::st execute failed: Unknown column 'id' in 'field list' at bugzilla2mantis-3.04.pl line 714.
DBD::mysql::st fetchrow failed: fetch() without execute() at bugzilla2mantis-3.04.pl line 716.

C:>perl bugzilla2mantis-3.2.3_fixed.pl
DBD::mysql::st execute failed: Unknown column 'id' in 'field list' at bugzilla2mantis-3.2.3_fixed.pl line 715.
DBD::mysql::st fetchrow failed: fetch() without execute() at bugzilla2mantis-3.2.3_fixed.pl line 717.
DBD::mysql::st execute failed: Unknown column 'fielddefs.type' in 'field list' at bugzilla2mantis-3.2.3_fixed.pl line 844.
DBD::mysql::st fetchrow failed: fetch() without execute() at bugzilla2mantis-3.2.3_fixed.pl line 848.

The Bugzilla version im trying to migrate from is v2.22.1

phowells

phowells

2010-02-03 13:21

reporter   ~0024302

I would use the Bugzilla 2.22 script then, the newer versions of bugzilla have different columns and that is why you can not query the columns.

KarlReichert

KarlReichert

2010-02-04 05:38

reporter   ~0024310

Thanks, this dumped my Bugzilla data without problems :)

But when importing the data into my Mantis database, it fails, because I already have existing projects in there. The dump tries to create new projects starting with ID 1, which of course fails, because an existing project already has ID 1. The same problem with categories, users ...

So it seems, that this script is only working with an empty Mantis database. I guess, there are two options:
a) go through the whole SQL dump file and replace all IDs with non-existing ones, which of course would mean a lot of work
b) edit the script to use different starting IDs, e.g. starting with IDs from 100 on or so, for all stuff (projects, users, categories, ...)

Or is there any other way to migrate an existing Bugzilla database into an already used Mantis database? I think, as long as this is not possible, a lot of users, willing to switch to Mantis, are not doing it, because of that fact!

kaner

kaner

2011-01-14 10:02

reporter   ~0027939

Here's a patch that makes this work with the latest Mantis for me:

--- /root/bugzilla2mantis-3.2.3_fixed.pl 2011-01-14 13:56:55.000000000 +0100
+++ ./bugzilla2mantis.pl 2011-01-14 16:01:23.000000000 +0100
@@ -359,7 +359,7 @@

my %projuser;

foreach $category (@categories) {

  • print SQL "INSERT INTO mantis_project_category_table (project_id, category, user_id) VALUES(";
  • print SQL "INSERT INTO mantis_category_table (project_id, name, user_id) VALUES(";
    print SQL $b_dbh->quote(${$category}{'project_id'}).", ";
    print SQL $b_dbh->quote(${$category}{'category'}).", ";
    print SQL $b_dbh->quote(${$category}{'user_id'}).");\n";
    @@ -461,7 +461,7 @@
    my $strQuery;

    if ($bugzillaHasProjectID == 1) {

  • $strQuery = "SELECT bug_id, assigned_to, bug_file_loc, bug_severity, bug_status, creation_ts, delta_ts, short_desc, op_sys, priority, product_id, rep_platform, reporter, version, (select name from components where id = component_id), resolution, target_milestone, short_desc FROM bugs";
  • $strQuery = "SELECT bug_id, assigned_to, bug_file_loc, bug_severity, bug_status, creation_ts, delta_ts, short_desc, op_sys, priority, product_id, rep_platform, reporter, version, (select id from components where id = component_id), resolution, target_milestone, short_desc FROM bugs";
    } else {
    $strQuery = "SELECT bug_id, assigned_to, bug_file_loc, bug_severity, bug_status, creation_ts, delta_ts, short_desc, op_sys, priority, product, rep_platform, reporter, version, component_id, resolution, target_milestone, short_desc FROM bugs";
    }
    @@ -639,7 +639,7 @@

    now iterate out the bugs themselves..

    foreach $bug (values %bugs) {

    $bug = $bugs{$bugid};

  • print SQL "INSERT INTO mantis_bug_table (id, project_id, reporter_id, handler_id, duplicate_id, priority, severity, reproducibility, status, resolution, projection, category, date_submitted, last_updated, eta, bug_text_id, os, os_build, platform, version, fixed_in_version, build, profile_id, view_state, summary, sponsorship_total) VALUES(";
  • print SQL "INSERT INTO mantis_bug_table (id, project_id, reporter_id, handler_id, duplicate_id, priority, severity, reproducibility, status, resolution, projection, category_id, date_submitted, last_updated, eta, bug_text_id, os, os_build, platform, target_version, fixed_in_version, build, profile_id, view_state, summary, sponsorship_total) VALUES(";
    print SQL $b_dbh->quote(${$bug}{'id'}).", ";
    print SQL $b_dbh->quote(${$bug}{'project_id'}).", ";
    print SQL $b_dbh->quote(${$bug}{'reporter_id'}).", ";
dregad

dregad

2012-09-27 12:54

developer   ~0032971

Last edited: 2012-09-27 12:57

View 2 revisions

This is documented in the FAQ on the wiki
http://www.mantisbt.org/wiki/doku.php/mantisbt:faq#migration_from_bugzilla_to_mantisbt

Issue History

Date Modified Username Field Change
2007-06-15 12:57 marc New Issue
2007-06-15 12:57 marc File Added: bugzilla2mantis.pl
2007-06-22 03:26 vboctor Relationship added related to 0007469
2007-12-12 08:27 epierre File Added: bugzilla2mantis-2.22.pl
2007-12-12 08:27 epierre Note Added: 0016434
2007-12-12 11:41 epierre Note Added: 0016435
2008-06-03 19:32 harlan Note Added: 0018001
2008-06-19 13:42 ryandesign Relationship added related to 0009283
2008-09-08 09:40 illes Note Added: 0019333
2008-09-10 14:18 siebrand Tag Attached: patch
2008-10-15 09:48 veitg File Added: bugzilla2mantis-3.04.pl
2008-10-15 10:00 veitg Note Added: 0019565
2009-05-22 08:54 phowells Note Added: 0021882
2009-05-22 09:03 phowells File Added: bugzilla2mantis-3.2.3.pl
2009-05-22 09:04 phowells Note Edited: 0021882 View Revisions
2009-06-29 16:38 phowells File Added: bugzilla2mantis-3.2.3_fixed.pl
2010-02-03 12:33 KarlReichert Note Added: 0024301
2010-02-03 13:21 phowells Note Added: 0024302
2010-02-04 05:38 KarlReichert Note Added: 0024310
2010-02-04 07:18 cor3huis Sponsorship Added cor3huis: US$ 25
2010-02-04 07:18 cor3huis Sponsorship Total 0 => 25
2011-01-14 10:02 kaner Note Added: 0027939
2012-08-28 04:11 dregad Relationship added related to 0008251
2012-09-27 12:54 dregad Note Added: 0032971
2012-09-27 12:54 dregad Status new => resolved
2012-09-27 12:54 dregad Resolution open => no change required
2012-09-27 12:54 dregad Assigned To => dregad
2012-09-27 12:57 dregad Note Edited: 0032971 View Revisions
2012-10-08 05:31 atrol Status resolved => closed