Project

General

Profile

Help upgrading RM 0.87 to 1.03?

Added by Robin Spiteri over 13 years ago

Hi folks,
I've been asked to perform an upgrade of our redmine installation from 0.87 to 1.0.3

My setup:

ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]

rails -v
Rails 2.3.5

gem -v
1.3.7

gem list
*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
daemon_controller (0.2.5)
dnsruby (1.50)
fastthread (1.0.7)
file-tail (1.0.5)
passenger (3.0.0)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
spruz (0.2.1)

So I installed all of the requirements for the new version, and they all seen to run.
I'm following the instructions here: http://www.redmine.org/wiki/redmine/RedmineUpgrade

At the last step, migrating the database I'm getting the following error.

rake db:migrate RAILS_ENV=production 
(in /var/www/rails/redmine-1.0.3)
rake aborted!
uninitialized constant ActionController::AbstractRequest

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

So here's the trace:

rake db:migrate RAILS_ENV=production --trace
(in /var/www/rails/redmine-1.0.3)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant ActionController::AbstractRequest
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
/var/www/rails/redmine-1.0.3/vendor/plugins/actionwebservice/lib/action_web_service/protocol/abstract.rb:74
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
/var/www/rails/redmine-1.0.3/vendor/plugins/actionwebservice/lib/action_web_service/protocol.rb:1
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
/var/www/rails/redmine-1.0.3/vendor/plugins/actionwebservice/lib/action_web_service.rb:46
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
/var/www/rails/redmine-1.0.3/vendor/plugins/actionwebservice/init.rb:1:in `evaluate_init_rb'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin.rb:158:in `evaluate_init_rb'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin.rb:154:in `evaluate_init_rb'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load'
/var/www/rails/redmine-1.0.3/config/../vendor/plugins/engines/lib/engines/plugin.rb:77:in `load'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/initializer.rb:369:in `load_plugins'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/initializer.rb:165:in `process'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/var/www/rails/redmine-1.0.3/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/var/www/rails/redmine-1.0.3/config/environment.rb:20
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/www/rails/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/var/www/rails/redmine-1.0.3/vendor/rails/railties/lib/tasks/misc.rake:4
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

I think the problem is that I'm getting confused by the plugin and migration steps - they're a little ambiguous (to me):

From the upgrade instructions:

5. Copy the folders of your installed plugins into new installation directory

so all I did here was a cp -R redmine-0.8.7/vendor/plugins/* redmine-1.0.3/vendor/plugins/
Is that what was intended?

I ask because in the database migration step these 2 bits are confusing to me:

rake db:migrate RAILS_ENV=production 

If you have installed any plugins, you should also run their database migrations. If you are upgrading from Redmine 0.8.x as part of this migration, you need to upgrade the plugin migrations first:

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
rake db:migrate_plugins RAILS_ENV=production 

When they say 'upgrading from Redmine 0.8.x as part of this migration, you need to upgrade the plugin migrations first:' is this just referring to a src checkout upgrade or does it include just unpacking a new archive?
Since I copied over the plugin directory, I didn't actually install anything - how do i even know what was an installed plugin, as opposed to a plugin included in the 0.8.7 version?
Is this step saying that if plugin file contents exist that the

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
rake db:migrate_plugins RAILS_ENV=production 

steps need to be carried out before the

rake db:migrate RAILS_ENV=production

step?

I'm not sure how to debug this problem, so I'd really appreciate any ideas you guys have!
Robin.


Replies (4)

RE: Help upgrading RM 0.87 to 1.03? - Added by Robin Spiteri over 13 years ago

Just for anyone else in the same predicament - the initial problem seems to be plugins - I looked at the state of the plugin directory in each version - the new version didn't have gloc-1.1.0, actionwebservice and redmine_issues_group
It turns out that gloc and actionwebservices are not included in the 1.0.3 redmine release.

Which left redmine_issues_group

as an aside, if you've just installed rails, you'll also need to install the mysql gem (not included by default anymore):

gem install mysql

So I started from scratch and this time only copied in the redmine_issues_group plugin - ran the

 rake db:migrate RAILS_ENV=production 
command and was rewarded with the following:

[root@web-dev redmine-1.0.3]# rake db:migrate RAILS_ENV=production 
(in /var/www/rails/redmine-1.0.3)
==  AddCustomFieldsEditable: migrating ========================================
-- add_column(:custom_fields, :editable, :boolean, {:default=>true})
   -> 0.1381s
==  AddCustomFieldsEditable: migrated (0.1387s) ===============================

==  SetCustomFieldsEditable: migrating ========================================
==  SetCustomFieldsEditable: migrated (0.0071s) ===============================

==  AddProjectsLftAndRgt: migrating ===========================================
-- add_column(:projects, :lft, :integer)
   -> 0.0244s
-- add_column(:projects, :rgt, :integer)
   -> 0.0193s
==  AddProjectsLftAndRgt: migrated (0.0445s) ==================================

==  BuildProjectsTree: migrating ==============================================
==  BuildProjectsTree: migrated (0.3172s) =====================================

==  RemoveProjectsProjectsCount: migrating ====================================
-- remove_column(:projects, :projects_count)
   -> 0.0158s
==  RemoveProjectsProjectsCount: migrated (0.0160s) ===========================

==  AddOpenIdAuthenticationTables: migrating ==================================
-- create_table(:open_id_authentication_associations, {:force=>true})
   -> 0.0635s
-- create_table(:open_id_authentication_nonces, {:force=>true})
   -> 0.0110s
==  AddOpenIdAuthenticationTables: migrated (0.0748s) =========================

==  AddIdentityUrlToUsers: migrating ==========================================
-- add_column(:users, :identity_url, :string)
   -> 0.0127s
==  AddIdentityUrlToUsers: migrated (0.0129s) =================================

==  AddWatchersUserIdTypeIndex: migrating =====================================
-- add_index(:watchers, [:user_id, :watchable_type], {:name=>:watchers_user_id_type})
   -> 0.0262s
==  AddWatchersUserIdTypeIndex: migrated (0.0264s) ============================

==  AddQueriesSortCriteria: migrating =========================================
-- add_column(:queries, :sort_criteria, :text)
   -> 0.0222s
==  AddQueriesSortCriteria: migrated (0.0224s) ================================

==  AddProjectsTrackersUniqueIndex: migrating =================================
-- add_index(:projects_trackers, [:project_id, :tracker_id], {:unique=>true, :name=>:projects_trackers_unique})
   -> 0.0172s
==  AddProjectsTrackersUniqueIndex: migrated (0.0487s) ========================

==  ExtendSettingsName: migrating =============================================
-- change_column(:settings, :name, :string, {:null=>false, :limit=>255, :default=>""})
   -> 0.0247s
==  ExtendSettingsName: migrated (0.0250s) ====================================

==  AddTypeToEnumerations: migrating ==========================================
-- add_column(:enumerations, :type, :string)
   -> 0.0367s
==  AddTypeToEnumerations: migrated (0.0369s) =================================

==  UpdateEnumerationsToSti: migrating ========================================
==  UpdateEnumerationsToSti: migrated (0.0190s) ===============================

==  AddActiveFieldToEnumerations: migrating ===================================
-- add_column(:enumerations, :active, :boolean, {:null=>false, :default=>true})
   -> 0.0094s
==  AddActiveFieldToEnumerations: migrated (0.0097s) ==========================

==  AddProjectToEnumerations: migrating =======================================
-- add_column(:enumerations, :project_id, :integer, {:null=>true, :default=>nil})
   -> 0.0098s
-- add_index(:enumerations, :project_id)
   -> 0.0171s
==  AddProjectToEnumerations: migrated (0.0274s) ==============================

==  AddParentIdToEnumerations: migrating ======================================
-- add_column(:enumerations, :parent_id, :integer, {:null=>true, :default=>nil})
   -> 0.0104s
==  AddParentIdToEnumerations: migrated (0.0106s) =============================

==  AddQueriesGroupBy: migrating ==============================================
-- add_column(:queries, :group_by, :string)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Duplicate column name 'group_by': ALTER TABLE `queries` ADD `group_by` varchar(255)

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

So it turns out that plugin will cause a migration failure. I'll need to go back to the start again (thank the stars for backups eh?)

RE: Help upgrading RM 0.87 to 1.03? - Added by Robin Spiteri over 13 years ago

Seems I can't get rid of the redmine_issues_group plugin.

When i manually remove the redmine_issues_group folder in /vendor/plugins/ , try

 rake db:migrate_plugins RAILS_ENV=production PLUGIN=redmine_issues_group VERSION=0 
(which seems to be the recommended way to remove a plugin.) and restart the webserver
/etc/rc.d/init.d/httpd restart
the plugin no longer appears in redmine. However following the upgrade steps in the documentation mentioned above has the same effect as before.

Does anyone have any ideas on this?

RE: Help upgrading RM 0.87 to 1.03? - Added by Felix Schäfer over 13 years ago

Robin Spiteri wrote:

When i manually remove the redmine_issues_group folder in /vendor/plugins/ , try [...] (which seems to be the recommended way to remove a plugin.) and restart the webserver [...] the plugin no longer appears in redmine. However following the upgrade steps in the documentation mentioned above has the same effect as before.

First run rake db:migrate:plugin RAILS_ENV=production NAME=redmine_issues_group VERSION=0 (not sure about the other command, but this one works for me), then delete the directory from vendor/plugins. The catch here is that the original author of the plugin must have included down migrations, i.e. migrations that revert the changes it has made to the DB.

RE: Help upgrading RM 0.87 to 1.03? - Added by Robin Spiteri over 13 years ago

Hi Felix,

cheers for offering the advice - much appreciated. I had tried removing the plugin folder, and leaving it be - each time trying the

rake db:migrate_plugins RAILS_ENV=production PLUGIN=redmine_issues_group VERSION=0 

step. (I noticed you used a slightly different syntax for this - so maybe if I had used that at the time it may have made a difference. (doh!)

Anyway, it's been a while since I performed this migration, so I'm a little bit hazy on the exact details of what i had to do to get it to work - but for anyone else that had the same issue - after I had to run the final

rake db:migrate RAILS_ENV=production 

command (that produced the output above)

I then had to modify the following file:
<your_path_to_redmine>/db/migrate/20100313132032_add_issues_nested_sets_columns.rb

and remove the duplicate column name mentioned each time I ran the rake db:migrate RAILS_ENV=production step. Don't get hasty and remove all the columns in that script - only do it in turn - I think the script complained about 3 columns for me at the time - removing all three at once broke the migration, removing each in turn and re-running the migration command seemed to do it.

Hope that helps someone else with their migration efforts. I would say to everyone be sure to have a database + file level backup before you attempt a migration - what worked for me may not work for you, and without a backup you're borked.
regards,
Robin.

    (1-4/4)