RhodeCode sqlite to Mysql migration

A migration path that worked for one user:

Here’s what worked for me, on a Ubuntu server. Adapt as needed for your server.

First, install the tools:

sudo gem install mysql 
sudo gem install mysql2 
sudo gem install sequel

Next, go into mysql and create the database. I called mine “rhodecode”. Grant permissions to whatever username and password you want RhodeCode to use. ie, at the mysql prompt, something like this:

create database rhodecode;
use mysql;
grant all on rhodecode to ‘someuser’@‘localhost’ identified by ‘somepassword’;
flush privileges;

Now install RhodeCode.

rccontrol install Enterprise

Give it all the info to connect to the mysql database you just created. Let it install. Then stop the server, using whatever server number it just created. For example:

rccontrol stop enterprise-1

Then go into mysql and drop that database entirely and recreate it. for example:

drop database rhodecode;
create database rhodecode;
use mysql;
grant all on rhodecode to ‘someuser’@‘localhost’ identified by ‘somepassword’;
flush privileges;

Then go back to the shell and do this:

sequel -C sqlite:///path/to/your/old/rhodecode.db mysql2://someuser:somepassword@localhost/rhodecode

That will convert the database over. (Same concept as taps, except this actually works.) Once that finishes successfully, just restart your RhodeCode server:

rccontrol start enterprise-1

Done.

With thanks to the page at http://dev.mikamai.com/post/119022544069/my-misadventures-while-migrating-a-rails-database that pointed me to sequel.

1 Like