Project

General

Profile

Uninstalling Plugins

Added by Devon Fritz over 12 years ago

Hey all,

I have a plugin that I would like to uninstall. However, when I follow the instructions on the (Redmine) website, I get migration errors and the migration to zero fails. What are my options here? Thanks.

Devon


Replies (7)

RE: Uninstalling Plugins - Added by Devon Fritz over 12 years ago

To be more explicit:

I upgraded my instance from 1.2x to 1.4.1 and found out the "Stuff To Do" plugin was broken in the new version. I then attempted to run the instructions:
rake db:migrate:plugin NAME=plugin_name VERSION=0 RAILS_ENV=production but this gave me an error:
@** Invoke db:migrate:plugin (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute db:migrate:plugin
    Migrating stuff_to_do_plugin to version 0 ...
    RemoveIdFromTimeGridIssuesUsers: reverting ==============================
    rake aborted!
    An error has occurred, all later migrations canceled:

undefined method `IrreversibleMigration' for ActiveRecord:Module
/srv/redmine/vendor/plugins/stuff_to_do_plugin/db/migrate/006_remove_id_from_time_grid_issues_users.rb:7:in `down_without_benchmarks'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `__send__'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:491:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `call'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `ddl_transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:490:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `each'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:405:in `down'
/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:385:in `migrate'
/srv/redmine/vendor/plugins/engines/lib/engines/plugin/migrator.rb:20:in `migrate_plugin'
/srv/redmine/config/../vendor/plugins/engines/lib/engines/plugin.rb:93:in `migrate'
/srv/redmine/vendor/plugins/engines/lib/tasks/engines.rake:127
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
Tasks: TOP => db:migrate:plugin
@

RE: Uninstalling Plugins - Added by Devon Fritz over 12 years ago

UPDATE: I even rolled my instance back to the old version and got the same issue.

RE: Uninstalling Plugins - Added by Devon Fritz over 12 years ago

I ended up manually undoing the data model changes in the plugins and removing the folders. This seems to have done it. Still interested in a better method if one exists. Thanks!

RE: Uninstalling Plugins - Added by Dmitri M over 12 years ago

Same story here

Could you please give a clue how you were "manually undoing the data model changes in the plugins" ?

Issues option doesn't work at all atm =(

RE: Uninstalling Plugins - Added by Devon Fritz over 12 years ago

Hey Dmitri -

First, I backed up everything :D

Then, I went through the migration folder and looked at the migrate up sections. This defines what columns/tables are added as a result of the script. For each one, I manually wrote mysql code to do the opposite migration. So, for example, if the script added a "stuff_to_do" table, I would delete that table. I did this for each migration script.

I'm sorry I don't have more details for you - Looking back I should have made a script so that other people could use it too. I didn't think of that at the time. Maybe you could do it if you get it working.

If you need more help let me know - maybe I can help with something.

Devon

RE: Uninstalling Plugins - Added by Dmitri M over 12 years ago

Thanks for your reply, Devon
Successfully removed all the crap out and now it works fine =)

RE: Uninstalling Plugins - Added by Nathan Eddle over 12 years ago

Another user with this problem reporting thus!

The above suggestion shouldn't be too hard when a migration adds things, you can simply remove those. But in 006_remove_id_from_time_grid_issues_users.rb I see this:

class RemoveIdFromTimeGridIssuesUsers < ActiveRecord::Migration
  def self.up
    remove_column :time_grid_issues_users, :id
  end

  def self.down
    raise ActiveRecord::IrreversibleMigration "Can't add the deleted primary key to the table" 
  end
end

How did you solve this one? Thanks.

Actually... maybe you can describe the steps involved? That would be great.

    (1-7/7)