Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about PostgreSQL? #2

Open
rlogiacco opened this issue Feb 8, 2010 · 6 comments
Open

What about PostgreSQL? #2

rlogiacco opened this issue Feb 8, 2010 · 6 comments

Comments

@rlogiacco
Copy link

I've PostgreSQL behind both bugzilla and redmine and I wish to use your tool for the migration.

I've changed the require="mysql" to require="pg" and replaced the

return Mysql::new(info.host, info.user, info.password, info.dbname)

with the equivalent for ruby-pg

return PGconn.connect(info.host, 5432, "", "", info.dbname, info.user, info.password)

Now I'm getting errors on the bz_select_sql, red_exec_sql and red_select_sql which, for what I understood, are the three functions used to read/write on the two databases (bugzilla and redmine).

I'm actually trying to convert those functions to their equivalent for the ruby-pg APIs but I'm really noob to ruby so I could appreciate your help.

BTW, I'm trying to migrate form bugzilla 3.2.2 to redmine 0.9.1

@ralli
Copy link
Owner

ralli commented Feb 10, 2010

Hi,
i created a migrate_from_bugzilla rake-task which should also work
with PostgreSQL.

You can find it here: http://github.com/ralli/migrate_from_bugzilla

can you please give me feedback, if it worked since i currently have no PostgreSQL installed on my machine (tested with mysql and sqlite).

@rlogiacco
Copy link
Author

Here is the output... it fails on something regarding mysql :(

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

By the way, I don't have MySQL on my box so the gem install mysql command fails due to lack of headers and libraries.

@ralli
Copy link
Owner

ralli commented Feb 11, 2010

can you provide more information?

  • does redmine start with "ruby script/server RAILS_ENV=production"?
  • have you got some "adapter: mysql" lines in your database yml?
  • can you try to replace the "adapter => 'mysql'" with "adapter => 'postgresql'" in line 406 of the migrate_from_bugzilla-script?

I am a bit surprised, since the migrate_from_bugzilla-script does not contain any
mysql-specific code.

HTH

Ralph

@ralli
Copy link
Owner

ralli commented Feb 12, 2010

Hi,
i can reproduce the problem on a box without mysql installed id if i answer
the question which adapter i should use with .

  • can you try to replace the "adapter => 'mysql'" with "adapter => 'postgresql'" in line 406 of the migrate_from_bugzilla-script?

Please enter settings for your Bugzilla database
adapter [mysql]:
host [localhost]:
database [bugzilla]:
username [bugzilla]:
password []:
ActiveRecord::BugzillaMigrate::BugzillaBug
ActiveRecord::BugzillaMigrate::BugzillaProfile
ActiveRecord::BugzillaMigrate::BugzillaProduct
ActiveRecord::BugzillaMigrate::BugzillaVersion
ActiveRecord::BugzillaMigrate::BugzillaDuplicate
ActiveRecord::BugzillaMigrate::BugzillaGroup
ActiveRecord::BugzillaMigrate::BugzillaComponent
ActiveRecord::BugzillaMigrate::BugzillaDependency
ActiveRecord::BugzillaMigrate::BugzillaAttachment
ActiveRecord::BugzillaMigrate::BugzillaAttachData
ActiveRecord::BugzillaMigrate::BugzillaDescription

Migrating profiles!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

(See full trace by running task with --trace)

@rlogiacco
Copy link
Author

Well, sorry for late answer but I got busy with other tasks ;-)

I'm now able to run the migration script but it seems to fail on migrating users complaining about a missing user id. I've some users in Bugzilla authenticating against LDAP and for each one of this users I get a failure during migration:

FAILURE #<User id: nil, login: "[email protected]", hashed_password: "", firstname: "[email protected]", lastname: "[email protected]", mail: "[email protected]", mail_notification: true, admin: true, status: 1, last_login_on: nil, language: "", auth_source_id: nil, created_on: nil, updated_on: nil, type: "User", identity_url: nil>

What I see strange is the "User id: nil" part which sounds to me like missing id so I went to the Bugzilla database and looked over the profiles table and I can assure you there are ids for each of the failing profiles.... By the way, it seems the same FAILURE statement is not produced for profiles not linked to LDAP accounts....

@rlogiacco
Copy link
Author

I've solved the problem caused by non valid firstname and lastname as for LDAP accounts they were set to the email address. I've added the following line to both def lastname and def firstname between the two return statements:

return s.split(/[@]+/).first if(s.include? "@")

I got another error for duplicate key as I had a group defined in redmine which uses the same table for users and groups but groups seems not being deleted from the script. Problem solved manually deleting the group in the redmine database.

Now I'm stuck with a "stack level too deep" error during products migration, here is the pastebin of the stack trace: http://pastebin.com/i8xYriXq

Obviously the last two lines are repeating for a long period and I've stripped them off :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants