BitnamiのRedmineを2.5.0に更新した

BitnamiのRedmine 1.2.1(!)を最新版の2.5.0に更新したので、覚え書を残しておく。動作環境は下記の通り。

インストールしたのは下記だ。

インストール自体は全く問題なく、正常に起動出来ることを確認した。(下記のインストールパスは、%REDMINE_HOME%と記載)

以下、設定を行う。

  • プラグインをコピーした(必要に応じて最新版に入れ替えた)。
  • テーマをコピーした。
  • バックアップから添付ファイルをコピーした。
  • データベースをバックアップからインポートした。
>mysql -u bitnami -p**** --default-character-set=utf8 bitnami_redmine  < redmine.sql

>rake db:migrate RAILS_ENV="production"
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 10.1.1.
Prepending `bundle exec` to your command may solve this.
(See full trace by running task with --trace)
>ruby bin\rake db:migrate RAILS_ENV=production
  • しかしながら、今度はテーブル作成に失敗してしまう。
>ruby bin\rake db:migrate RAILS_ENV=production
==  CreateChangesetParents: migrating =========================================
-- create_table(:changeset_parents, {:id=>false})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'changeset_parents' already exists: CREATE TABLE `changeset
_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE
=InnoDBc:/app/Bitnami/redmine-2.5.0-0/apps/redmine/htdocs/vendor/bundle/ruby/1.9
.1/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_mysql
_adapter.rb:245:in `query'
  • 下記を参考に、既存テーブルを削除したところ成功した。
mysql> drop table changeset_parents;

It seems this table was created by a plugin. Could you remve this table and try again?

  • しかし、今度は別のテーブルで同様のエラーが発生した。
==  CreateQueriesRoles: migrating =============================================
-- create_table(:queries_roles, {:id=>false})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'queries_roles' already exists: CREATE TABLE `queries_roles
` (`query_id` int(11) NOT NULL, `role_id` int(11) NOT NULL) ENGINE=InnoDBc:/app/
Bitnami/redmine-2.5.0-0/apps/redmine/htdocs/vendor/bundle/ruby/1.9.1/gems/active
record-3.2.17/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:24
5:in `query'
mysql> drop table custom_fields_roles;
Query OK, 0 rows affected (0.03 sec)
mysql> drop table queries_roles;
Query OK, 0 rows affected (0.08 sec)
>ruby bin\rake db:migrate RAILS_ENV=production
>ruby bin\rake redmine:plugins:migrate RAILS_ENV=production
  • セッションをクリアした。
>ruby bin\rake tmp:cache:clear
>ruby bin\rake tmp:sessions:clear

Redmineを再起動して、元のデータが復元され正常に動作することを確認した。元のバージョンがかなり古かったので更新に手間取ったけど、それでも正常に移行出来るのは良く出来た仕組みだと思う。