ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins'

Added by Paweł O at 2011-12-05 06:51 am

I want to migrate from existing Redmine to Chiliproject unfortunatelly I encountered an error.

These are the steps that I have done:
  • I had a working Redmine 1.0.5 install with:
    • some additional plugins (Author box, Extended profile, Redmine Auto Watch plugin, BigBlueButton plugin, Blocks Layout plugin, Redmine Polls, Blocks layaout plugin, Screenshot Paste, Redmine Theme Changer plugin, Single Project Forward, LighBox)
    • and some additional themes
  • On another server I did a fresh install of Chiliproject 2.4.0 with the above plugins and some additional ones (DMSF, Projects Tree View, Redmine Wiki Extensions Plugin, Time Tracker, Time Sheet plugin, ChiliProject Issue Aging, Redmine Stuff To Do Plugin) and also the same themes as in Redmine.
    Fresh install worked fine, "rake db:migrate:plugins" were clean, I could log into Chiliproject as an admin.
  • On Redmine server I did backup of files directory (with tar to tgz archive) as well as mysql redmine_default database (with mysqldump to sql file). Then I copied both files to the new Chiliproject server.
  • Based on Chiliproject upgrade instrauctions but starting with Step 6 I did:
    • rake db:migrate RAILS_ENV=production it wen ok.
    • rake db:migrate:plugins RAILS_ENV=production where I got the following error:
      Migrating plugin contact_form ...
      Migrating plugin extended_profile ...
      Migrating plugin redmine_blocks_layout ...
      ==  CreateTables: migrating ===================================================
      -- create_table(:overview_blocks)
      rake aborted!
      An error has occurred, all later migrations canceled:
      
      Mysql::Error: Table 'overview_blocks' already exists: CREATE TABLE `overview_blo                                                                    11) NOT NULL, `name` varchar(255) NOT NULL) ENGINE=InnoDB
      
      Tasks: TOP => db:migrate:plugins
      (See full trace by running task with --trace)
      

Now I wonder what is the cause of this error. Yet the table overview_blocks should exist since it existed in Redmine installation as well as in fresh install of Chiliproject (though now it gets on my mine the the later one was probably droped while doing mysql import of Redmine backup).
Just to try to correct this error I have manually drop the above mentioned table from mysql and try db:migrate:plugins again but then another existing table gave the error. And after deleting a new one, another one came out...

So could you please explain how could I correct the problem here or what the correct steps for migration should be.


Replies (6)

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Felix Schäfer at 2011-12-05 08:32 am

Hi Pawel,

Don't create the ChiliProject DB before importing your Redmine DB.

The database "knows" itself which version it is on, and the rake db:migrate and db:migrate:plugins tasks look at that version and only apply newer changes. The error you get is because you create a "new" ChiliProject database, say it has the version 50, and you copy your Redmine DB over that, which has maybe version 40, and copying your Redmine DB over overwrites this version info too. So now you have a DB which thinks it is in version 40 but has some new tables from version 50, and rake db:migrate:plugins tries to apply all changes from 40 to 50 and fails because the tables already exist.

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Paweł O at 2011-12-07 07:14 am

Felix thanks for the answer. I followed your advise (on a new install):
  • completelly removed chiliproject database
  • created a new database
  • imported the old database
  • did rake db:migrate RAILS_ENV=production (done ok)
  • did rake db:migrate:plugins RAILS_ENV=production
    Unfortunatelly the last one finished again with the error.

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Felix Schäfer at 2011-12-09 01:39 pm

Paweł O wrote:

Unfortunatelly the last one finished again with the error.

That's peculiar. Could you try importing your DB into a blank ChiliProject (one without the plugins installed) and install the plugins one by one? I guess redmine_blocks_layout is misbehaving. Could you also provide me the contents of the schema_migrations table from your "old" DB and a link to the redmine_blocks_layout plugin so that I can check what could be going wrong? Thanks!

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Paweł O at 2011-12-10 06:03 am

In the meantime I repeated the procedure with Chiliproject 2.5.0 and the situation is the same. Definitely the "redmine_block_layout" is the problem here. When I remove that plugin everything goes ok (well there is another problem with another plugin posted here but I think both are not connected in anyway). So your guess about misbehaviour is right:-)
Another way of overcoming the error is to remove three tables from database:
  • redmine_blocks_layout
  • home_blocks
  • overview_blocks

I have attached contents of the schema_migrations table from my "old" DB but I do not know how I can provide you with a link to the redmine_blocks_layout plugin.
Thanks a lot.

schema_migrations.txt - schema_migrations export from redmine 'old' database (3.2 kB)

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Felix Schäfer at 2011-12-10 01:21 pm

Paweł O wrote:

I have attached contents of the schema_migrations table from my "old" DB but I do not know how I can provide you with a link to the redmine_blocks_layout plugin.

I meant a link to the repository where I could have a look at the code ;-)

Anyway, I think I have found the error. In your old installation, you have probably installed the plugin to redmine_blocks, and in your new install to redmine_blocks_layout, the database versioning system recognizes plugin migrations based on the name of the directory they're in though.

You have 2 choices here: Either install the plugin to redmine_blocks and remember to continue to do so in the future, or change 1-redmine_blocks to 1-redmine_blocks_layout in your schema_migrations table.

Edit: corrected new name of the plugin.

RE: Migration from Redmine to Chiliproject with 'table exists' mysql error during 'db:migrate:plugins' - Added by Paweł O at 2011-12-11 09:10 pm

Thanks a lot Felix! :-)

I did not know what is the purpose of schema_migrations table. I do not know it now either (maybe you can point me to the right place where it is explained) but I realized now that the names of the plugins there should be the same as plugin directory name.

So I edited the schema_migrations table to reflect a new directory names for all plugins in new install and now it works:-)

Thanks once more!

(1-6/6)