Issue 3495: Migration from H2 database to MySQL
Status:  New
Owner: ----
Reported by vlad.khudyakov, Jul 26, 2015
Hello,
Is there any way/utility for migrating H2 database to the new MySQL database with all changes/users/ssh keys?
Tried to export tables to csv by call CSVWRITE and import to MySQL but with no success. New Gerrit site ignore new imported changes and fail to add new changes because of duplicate entry (gerrit try to add new entry that already exist in MySQL)

So I tried importer plugin but this plugin import only projects, changes and groups and not users and ssh keys.

In connection with the increased workload I have to go to the new infrastructure which includes slaves, and the main obstacle is a database migration.



Nov 11, 2015
#1 coll...@gmail.com
I have tried hard to do the same migration.
There are a lot of traps. Fortunately, I end up with some helpful tools and success.
Check this out: https://github.com/uppet/h2tomysql_for_gerrit
Nov 11, 2015
#2 vlad.khudyakov
Thanks, I have already solved it too, export with jdbc connector to backup.sql, after that with script: renaming tables, changing syntax to MySQL, replacing characters in comments that mysql not support like \\, ''), ')), etc.  set autoincrement like this:
ALTER TABLE account_group_id AUTO_INCREMENT=1079;       
ALTER TABLE change_message_id AUTO_INCREMENT=5963;      
ALTER TABLE account_id AUTO_INCREMENT=1002697;          
ALTER TABLE change_id AUTO_INCREMENT=58503;  

Truncating tables on target MySQL server and import with Workbench