dr-itz / RedminePlannerPlugin

Resource planning plugin for Redmine 2.x/3.x - UNMAINTAINED
Other
42 stars 22 forks source link

Unable to uninstall plugin #13

Closed ppoektos closed 11 years ago

ppoektos commented 11 years ago

Environment: Redmine version 2.3.0.stable.11670 Ruby version 1.9.3 (i686-linux) Rails version 3.2.13 Environment production Database adapter Mysql2 Redmine plugins: planner 0.4 redmine_drafts 0.2.0 redmine_fields_permissions 1.0.0 redmine_hide_estimated_hours 1.0.3 redmine_knowledgebase 2.2.0 redmine_lightbox 0.0.1 redmine_monitoring_controlling 0.1.1 redmine_timesheet_plugin 0.7.0

[root@redmine rm2.3.0]# rake redmine:plugins:migrate NAME=planner VERSION=0 RAILS_ENV=production Migrating planner (Planner)... == ModPlanTasksDescr: reverting ============================================== rake aborted! An error has occurred, all later migrations canceled:

ActiveRecord::IrreversibleMigration /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration/command_recorder.rb:42:in block in inverse' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration/command_recorder.rb:40:inmap' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration/command_recorder.rb:40:in inverse' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:401:inblock (3 levels) in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:358:in revert' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:400:inblock (2 levels) in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:399:in block in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:inwith_connection' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:389:in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:528:inmigrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:720:in block (2 levels) in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:777:incall' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:777:in ddl_transaction' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:719:inblock in migrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:700:in each' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:700:inmigrate' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:574:in down' /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.13/lib/active_record/migration.rb:555:inmigrate' /var/www/rm2.3.0/lib/redmine/plugin.rb:453:in migrate_plugin' /var/www/rm2.3.0/lib/redmine/plugin.rb:425:inmigrate' /var/www/rm2.3.0/lib/redmine/plugin.rb:436:in migrate' /var/www/rm2.3.0/lib/tasks/redmine.rake:74:inblock (3 levels) in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in eval' /usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in

' Tasks: TOP => redmine:plugins:migrate (See full trace by running task with --trace)

dr-itz commented 11 years ago

Fix pushed...

ppoektos commented 11 years ago

Unfortunately your fix don't work: [root@redmine rm2.3.0]# rake redmine:plugins:migrate NAME=planner VERSION=0 RAILS_ENV=production Migrating planner (Planner)... == ModPlanTasksDescr: reverting ============================================== -- remove_column(:created_at) rake aborted! An error has occurred, all later migrations canceled:

You must specify at least one column name. Example: remove_column(:people, :first_name)

I'm not expert, but maybe you need to include: def self.down drop_table :table_name end in each .rb file under redmine/planner/db/migrate

jrevillard commented 11 years ago

Not working for me too

dr-itz commented 11 years ago

I tested the whole DB migrations like this (on an old Redmine 2.0 installation):

The ModPlanTaskDescr actually has a 'up' and 'down'. It's not necessary for the other migrations since they use 'change'. This works both ways for most, but not all changes. One of the changes that is not reversible is t.change (a change in data type). Others work fine.

Probably the problem you are facing is this: You first tried to uninstall with the broken version of the migration. This basically means it runs everything in 'change' from backwards from bottom to top with the function reversed. The last thing there is 't.timestamps'. Since for the uninstall case this gets run first, the timestamps were already removed when it hit the t.change that is not reversible. Now the fixed version of the migration tries to remove the the two timestamp column (:created_at, :updated_at) and fails...So the fix in your case is to simply delete these two rows from 007_mod_plan_tasks_descr.rb:

remove_column :created_at
remove_column :updated_at
dr-itz commented 11 years ago

Ok, this is now fixed for real, see #14

ppoektos commented 10 years ago

Thanks, now it works!