Git Product home page Git Product logo

migrate_from_bugzilla's Introduction

This is a rake task to  convert your existing bugzilla database to
a redmine database. Bugzilla is a popular Bugtracking-System. Redmine
is a increasingly popular bugtracking system as well. Compared with Bugzilla,
Redmine has a couple of unique features.

The task is based on the work of Arjen Roodselaar, Lindix bv.

== Features

* Keeps a Record of the original Bugzilla Bugnumbers
* Converts most of the existing Bugzilla-Data including attachments
  and relations between issues.


== Usage

* Put the migrate_from_bugzilla.rake file into the lib/tasks directory
  of your Redmine installation.
* Backup your Databases and your existing redmine installation.
* If you are working on a new installation of redmine make shure you ran
  "rake redmine:load_default_data".
* Run the script using "rake redmine:migrate_from_bugzilla" and enter the connection settings of your bugzilla database.


migrate_from_bugzilla's People

Contributors

cchavez avatar doublemalt avatar kastork avatar ralli avatar silex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

migrate_from_bugzilla's Issues

Error: incomplete multibyte character

There is a bug in line 326: category = IssueCategory.new(:name => component.name[0,30])
For UTF-8 encoding truncating to 30 chars, sometimes produces broken string, in which the last byte is truncated.

Replace this line with: category = IssueCategory.new(:name => component.name)

There is a db schema limit to 30 chars for issueCategory.Name but thats not a problem with most db they will truncate string by them-self.

Validation failed: Tracker is not included in the list

Hello!

Both bugzilla and redmine are using mysql databases, the script aborts at the issue migration:

Migrating profiles
...................................................
Migrating products....................................
Migrating relationship product/profile
Migrating issues
rake aborted!
Validation failed: Tracker is not included in the list
/var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/validations.rb:56:in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/dirty.rb:33:insave!'
/var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:in block in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:313:inblock in with_transaction_returning_status'
/var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in transaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:208:intransaction'
/var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:311:in with_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:insave!'
/opt/redmine/lib/tasks/migrate_from_bugzilla.rake:403:in block in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:ineach'
/opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:574:inmodule:BugzillaMigrate'
/opt/redmine/lib/tasks/migrate_from_bugzilla.rake:46:in block (2 levels) in <top (required)>' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:incall'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:in block in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:ineach'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:175:inblock in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:168:ininvoke_with_call_chain'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:161:in invoke' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:149:ininvoke_task'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in block (2 levels) in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:ineach'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in block in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:115:inrun_with_threads'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:100:in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:78:inblock in run'
/var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:165:in standard_exception_handling' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:75:inrun'
/var/lib/gems/2.1.0/gems/rake-10.1.1/bin/rake:33:in <top (required)>' /usr/local/bin/rake:23:inload'
/usr/local/bin/rake:23:in `

'
Tasks: TOP => redmine:migrate_from_bugzilla

After some research I found the cause of the problem. You have to assign the tracker "Bug" to the newly created project, so I added the line 316:

    BugzillaProduct.find_each do |product|
      project = Project.new
      project.name = product.name
      project.description = product.description
      project.identifier = "#{product.name.downcase.gsub(/[^a-z0-9]+/, '-')[0..10]}-#{product.id}"
      project.is_public = false
      project.trackers << TRACKER_BUG unless project.trackers.include?(TRACKER_BUG)
      project.save!

Then the migration worked like a charm.

Question about migration

We are using Bugzilla3.4 and now I am planning to switch over to Redmine. Can you please tell me if I use this script for migration current Bugzilla DB (data) will be removed and moved to redmine?

If it is so then can you please tell me how to copy data from Bugzilla to Redmine.

relationship between "bugs" and "category" not preserve

I have Bugzilla 3.4.2 on hosting and local installed Ubuntu 10.04.2 with Redmine Stack 1.1.3.1 installed as root in โ€œ/opt/..โ€
Successful transfer about 1600 bugs from bugzilla with attachments.
In Bugzilla bugs have been assigned to the related "components" that have been transformed into a "category" , however in Redmine this relationship was not preserved and bugs were assigned only to projects but not to categories.
is that bug ? or script can't preserve relationship between "bugs" and "category" ?

Line 96 - spurious 'y' char?

On line 96, the script barfs on what appears to be a spurious character 'y' at the start of the line.

Remove it and all is well.

Seems to have been introduced in commit 060507d. Not sure why no-one's caught it before now...

Error when trying to run the script on Redmine 2.2.3

(in /var/www/redmine)
rake aborted!
Don't know how to build task 'db:migrate_from_bugzilla'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task_manager.rb:49:in []' /var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:148:ininvoke_task'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in block (2 levels) in top_level' /var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:ineach'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in block in top_level' /var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:115:inrun_with_threads'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:100:in top_level' /var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:78:inblock in run'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:inrun'
/var/lib/gems/1.9.1/gems/rake-10.1.0/bin/rake:33:in <top (required)>' /usr/local/bin/rake:23:inload'
/usr/local/bin/rake:23:in `

'

rake aborted!

category migrated successful.
but.. terminated, and attachments not migrate.
don't know why.. prev. version 9106da9 work good, till the end but without category.

......................................
Migrating attachments........rake aborted!
Validation failed: File can't be blank
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/validations.rb:1102:in `save_without_dirty!'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/dirty.rb:87:in `save_without_transactions!'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:200:in `save!'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:182:in `transaction'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:200:in `save!'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/transactions.rb:200:in `save!'
/opt/redmine-1.1.3-1/apps/redmine/lib/tasks/migrate_from_bugzilla.rake:422:in `migrate_attachments'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/batches.rb:26:in `find_each'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/batches.rb:26:in `each'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/batches.rb:26:in `find_each'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/batches.rb:66:in `find_in_batches'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/batches.rb:25:in `find_each'
/opt/redmine-1.1.3-1/apps/redmine/lib/tasks/migrate_from_bugzilla.rake:416:in `migrate_attachments'
/opt/redmine-1.1.3-1/apps/redmine/lib/tasks/migrate_from_bugzilla.rake:511
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/redmine-1.1.3-1/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/redmine-1.1.3-1/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/redmine-1.1.3-1/ruby/bin/rake:19:in `load'
/opt/redmine-1.1.3-1/ruby/bin/rake:19
bash-4.1# 

Validation failed: Tracker is not included in the list

I need your help to concluded the migration from bugzilla to redmine.
Could you help me with that?

Both of databases are on PostgreSQL

Thanks.

Migrating profiles
.
Migrating products......
rake aborted!
Validation failed: Tracker is not included in the list
/usr/lib/ruby/1.8/active_record/validations.rb:1090:in save_without_dirty!' /usr/lib/ruby/1.8/active_record/dirty.rb:87:insave_without_transactions!'
/usr/lib/ruby/1.8/active_record/transactions.rb:200:in save!' /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/database_statements.rb:136:intransaction'
/usr/lib/ruby/1.8/active_record/transactions.rb:182:in transaction' /usr/lib/ruby/1.8/active_record/transactions.rb:200:insave!'
/usr/lib/ruby/1.8/active_record/transactions.rb:208:in rollback_active_record_state!' /usr/lib/ruby/1.8/active_record/transactions.rb:200:insave!'
/usr/share/redmine/lib/tasks/migrate_from_bugzilla.rake:380:in migrate_issues' /usr/share/redmine/lib/tasks/migrate_from_bugzilla.rake:355:ineach'
/usr/share/redmine/lib/tasks/migrate_from_bugzilla.rake:355:in migrate_issues' /usr/share/redmine/lib/tasks/migrate_from_bugzilla.rake:511 /usr/lib/ruby/1.8/rake.rb:636:incall'
/usr/lib/ruby/1.8/rake.rb:636:in execute' /usr/lib/ruby/1.8/rake.rb:631:ineach'
/usr/lib/ruby/1.8/rake.rb:631:in execute' /usr/lib/ruby/1.8/rake.rb:597:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/1.8/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in invoke' /usr/lib/ruby/1.8/rake.rb:2051:ininvoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in top_level' /usr/lib/ruby/1.8/rake.rb:2029:ineach'
/usr/lib/ruby/1.8/rake.rb:2029:in top_level' /usr/lib/ruby/1.8/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in top_level' /usr/lib/ruby/1.8/rake.rb:2001:inrun'
/usr/lib/ruby/1.8/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1998:inrun'
/usr/bin/rake:28

undefined method `namespace' for ActiveRecord:Module

I'm using TurnkeyLinux Redmine stack
and updated

  • Redmine to version 2.2.2
  • Rails to version 3.2.11
  • Rake to version 10.0.3
  • Ruby is still on version 1.8.7

After copying migrate_from_bugzilla.rake to /lib/tasks and running rake redmine:migrate_from_bugzilla.rake --trace

I receive the following output:

rake aborted!
undefined method `namespace' for ActiveRecord:Module
/var/www/redmine-2.2/lib/tasks/migrate_from_bugzilla.rake:28
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:425:in `load'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:425:in `load_tasks'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:425:in `each'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:425:in `load_tasks'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:145:in `load_tasks'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/redmine-2.2/Rakefile:7
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:583:in `raw_load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:89:in `load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:88:in `load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:72:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-10.0.3/bin/rake:33
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23

How to fix this?

Any help apreciated.

Regards
Michael

All dates being set to migration date

First of all, thanks a lot for this great utility. It's really saving me a ton of work!

I'm migrating a medium-size bugzilla database. The script is being executed on the following environment:

  • Bugzilla version: 4.2.4
  • Redmine version: 2.3.2
  • Ruby 1.9.3p194
  • mySQL 5.5.32
  • Linux Mint 15
  • Database size (approx 11,000 tickets)

The migration script ends OK and all the tickets look quite alright, except for the timestamp dates (created_on, updated_on, closed_on) which are all set to the moment the migration was executed instead of the original values. This happens for issues, comments (journals) and attachments.

The start_date and due_date, nevertheless, are set to the right values. Maybe this has to do with the fact they are only dates and not complete timestamps?

Validation failed: Source version can't be blank

Hello,

I am trying to migrate from Bugzilla version 3.4.4 (MySQL) to Redmine 1.3.2.stable.9322 (MySQL) but I got following error during migration.

Migrating profiles
.
Migrating products.......
rake aborted!
Validation failed: Source version can't be blank

I was trying to solve it myself, but I could not find where the "Source version" is defined as I am not familiar with ruby or rails.

Thanks for any help or hint.

Blocking relations seem to be inverted

Having a look at the results of migrating my database I discovered that blocking relations are inverted.

When in Bugzilla happens that:

  • Bug X blocks Bug Y
  • (as a consequence) Bug Y depends on Bug X

Once migrated to Redmine, this is inverted:

  • Bug X is blocked by Bug Y
  • (as a consequence) Bug Y blocks Bug X

Import uses previously assigned primary key for admin user

Redmine 0.9.2

I've created a fresh Redmine install and run the default data loader. Additionally, I've visited the Redmine site and logged in as the admin user. This prompts again for default data loading, which I permitted.

I then run the migration and get

Migrating profilesrake aborted!
Mysql::Error: Duplicate entry '1' for key 1: INSERT INTO `users` (`created_on`, `hashed_password`, `admin`, `language`, `lastname`, `mail`, `updated_on`, `id`, `type`, `firstname`, `mail_notification`, `login`, `status`, `identity_url`, `last_login_on`, `auth_source_id`) VALUES( <omitted>)

The problem is that the default admin user has primary key 1.

Now I've gotten it to work by going through and adding 1 to all the places where a user id is set in the new database. Things look okay, but it doesn't seem like a good long term solution. You can see the changes in my fork of the project.

Issue priorities reversed and off-by-one

I believe the issue priority hash map is reversed and off by one:

PRIORITY_MAPPING = {
     "P1" => priorities[1], # low
     "P2" => priorities[2], # normal
     "P3" => priorities[3], # high
     "P4" => priorities[4], # urgent
     "P5" => priorities[5]  # immediate
}

The priorities array starts at 0. As for reversed, we have always used P1 == highest priority - I'm not sure if there's an official Bugzilla convention for this, but I thought I'd mention it anyway.

For our migration, I had to change the mapping as follows:

PRIORITY_MAPPING = {
     "P5" => priorities[0], # low
     "P4" => priorities[1], # normal
     "P3" => priorities[2], # high
     "P2" => priorities[3], # urgent
     "P1" => priorities[4]  # immediate
 }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.