Proper method of upgrading plugins?

Added by Avram Eisner about 11 years ago

Environment Info
OS: Ubuntu 9.04 (jaunty)
MySQL version: 5.0.75
Server: Phusion Passenger

script/about output:
About your application's environment
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /home/deploy/rails_apps/redmine
Environment production
Database adapter mysql
Database schema version 20100819172912

About your Redmine plugins
Google Calendar Plugin 0.1.2
Timesheet Plugin 0.5.0
Thumbnails plugin 0.1.0
Rate Plugin 0.1.0
Stuff To Do Plugin 0.3.0
Redmine Wiki Extensions plugin
Budget 0.2.0

Issue Description
I just upgraded from 0.8.7 to 1.0.1 and it went without a hitch.
A few plugins were out of date so I decided to update those as well. I looked on this site and on the plugin sites themselves for information on how to upgrade a plugin, but I was surprised to find no information on the topic. I figured it must simply involve overwriting the old plugin directory and maybe running rake db:migrate_plugins.
That's what I did, but upon running rake db:migrate_plugins, I got this error:

Migrating engines...
Migrating acts_as_activity_provider...
Migrating acts_as_attachable...
Migrating acts_as_customizable...
Migrating acts_as_event...
Migrating acts_as_list...
Migrating acts_as_searchable...
Migrating acts_as_tree...
Migrating acts_as_versioned...
Migrating acts_as_watchable...
Migrating awesome_nested_set...
Migrating budget_plugin...
==  CreateDeliverables: migrating =============================================
-- create_table(:deliverables)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'deliverables' already exists: CREATE TABLE `deliverables` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `subject` varchar(255), `due_date` date, `description` text, `type` varchar(255), `cost` decimal(15,2), `project_manager_signoff` tinyint(1) DEFAULT 0, `client_signoff` tinyint(1) DEFAULT 0) ENGINE=InnoDB

The budget plugin wasn't one of the plugins that I attempted to update, so I figured I could temporarily remove it from the plugins directory to see if the script would continue through the rest of the plugins. I did so and after running rake db:migrate_plugins once more I got a similar error from another plugin (again one that I hadn't attempted to upgrade).

So I guess I have two questions. 1. How should I go about upgrading a plugin? 2. Is it normal for plugins to cause rake db:migrate_plugins to abort like that, or are these plugins just poorly written? Or am I doing this all wrong?

Any help is appreciated.

Replies (5)

RE: Proper method of upgrading plugins? - Added by Holger Just about 11 years ago

Please see RedmineUpgrade for detailed steps about upgrading your Redmine. In your case, you missed the

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
mentioned in step 4.

The issue is not caused by the plugins but by your redmine upgrade. Rails 2.2 (used by Redmine 0.8.x) stores the info about plugin migrations in another place and format than the rails 2.3.5 used by Redmine 0.9 and above. Be very careful, you just might have destroyed your database schema by performing the migrations again. If you can, go back to a backup of a state before the database upgrade. and perform it again by following the checklist.


RE: Proper method of upgrading plugins? - Added by Avram Eisner about 11 years ago

Thank you Holger, that worked perfectly!

The reason I skipped that step is because the instructions read:
If you are upgrading to Rails 2.2.2 as part of this migration...

It should read:
If you are upgrading from Rails 2.2.2 as part of this migration...


RE: Proper method of upgrading plugins? - Added by Pierre de LESPINAY almost 4 years ago

I was neither able to find indications about how to update a plugin.
Based on this 7 years old thread I'm guessing these are the step:

$ rm -r rails_root/plugins/plugin-to-update
$ mv new-version rails_root/plugins/plugin-to-update
$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production

Am I right ?

RE: Proper method of upgrading plugins? - Added by Pavel Potcheptsov almost 4 years ago

You're right. Don't forget to restart redmine.

RE: Proper method of upgrading plugins? - Added by donny osmon almost 4 years ago

Don't you have to run bundle install before replacing those files?