Project

General

Profile

Troublesome upgrade from 0.8.4 to 1.0.0

Added by Paulo Santos over 13 years ago

Hi everyone, I could use your help upgrading Redmine 0.8.4 to 1.0.0. I followed the instructions supplied here, until the point where I had only the plugins supplied by the new 1.0.0 distribution, and tried to:

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production

... rendering it to an infinite loop,

Inserting new version # for plugin redmine_issues_group..

... so I skipped that step, and proceeded with the ones next. All seamed fine, Redmine site all worked as expected, apart from the missing plugins from before (keep in mind the DB already has the data from those plugins, only they are not yet on vendor/plugins), so I tried to add now some updated versions of the plugins I was using with the 0.8.4 installation. One of the plugins is the must have Wiki Extensions at version 0.2.2, which failed

rake db:migrate_plugins RAILS_ENV=production

... returning:

Mysql::Error: Table 'wiki_extensions_comments' already exists: CREATE TABLE `wiki_extensions_comments` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `wiki_page_id` int(11), `key_word` varchar(255), `user_id` int(11), `comment` text, `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB

Wiki Extensions plugin isn't the only one returning this error, most of the plugins from before (even the ones which have no updated version), return similar errors... table already exists, field already exists...

So, how can I fix the recursive ‹‹ rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production ›› command, and the plugins failing to migrate?


Replies (5)

RE: Troublesome upgrade from 0.8.4 to 1.0.0 - Added by Felix Schäfer over 13 years ago

I think you have to have the plugins installed when rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production, otherwise the rake task won't have all the info it needs to upgrade the engines migration table.

RE: Troublesome upgrade from 0.8.4 to 1.0.0 - Added by Paulo Santos over 13 years ago

Do you mean all the plugins I had installed previously? What about those which are now incompatible with Redmine 1.0.0, and prevent the migration to continue, how can I uninstall them from DB?

RE: Troublesome upgrade from 0.8.4 to 1.0.0 - Added by Felix Schäfer over 13 years ago

Uninstalling a plugin from the DB is something like rake db:migrate:plugin NAME=plugin VERSION=0 (syntax nor verified), though that will erase all your data.

I think (I am not at all familiar with the rails engines (what powers the redmine plugins) changes, so take that with a grain of salt/try it out before doing this on a productive installation) having the plugins installed and upgrading the migration tables with upgrade_plugin_migrations, then deleting the folders of whatever plugins you don't want to keep (keeping the database stuff from the plugins shouldn't be a problem here) and go on from there could work.

RE: Troublesome upgrade from 0.8.4 to 1.0.0 - Added by Paulo Santos over 13 years ago

Thanks for the help Felix. It didn't work just like that, but it did help to clear the path though :)
The overall official instructions to upgrade Redmine weren't very effective to me, I had to go through several challenges along the way, with hints scattered on the web. Perhaps someone else is going through similar problems upgrading Redmine so I'll just post here the recipe which worked for me.

My environment setup was:
  • Ubuntu Server 9
  • Apache 2
  • MySQL 5
  • Redmine 0.8.4
  • SVN 1.6
Recipe:
  1. notify users the service will be offline for upgrade (DUH!)
  2. stop apache service, so no one could use Redmine during the upgrade process
    sudo /etc/init.d/apache2 stop
  3. make a full backup of Redmine DB
    mysqldump -u<login> -p<password> <redmine_db_name> > redmine-db.dmp
  4. make a full backup of Redmine settings, uploaded files, and eventual personalized themes
    ./<redmine_dir>/config/database.yml
    ./<redmine_dir>/config/email.yml
    ./<redmine_dir>/files/*
    ./<redmine_dir>/public/themes/*
  5. download newest Redmine version, and updated versions of the Plugins to be used
  6. move aside oldest Redmine dir
  7. unpack newest Redmine version to the same dir used before
  8. copy backed up Redmine settings, uploaded files, and themes back to new Redmine dir, along with the new set of Plugins
  9. session store actions
    rake config/initializers/session_store.rb
    rake generate_session_store
  10. upgrade Redmine required software
    sudo gem install rack -v=1.0.1 -V
    sudo gem install rack mysql
    sudo gem install rails -v=2.3.5 -V
  11. upgrade Redmine DB
    rake db:migrate RAILS_ENV=production
  12. upgrade Plugins DB
    rake db:migrate:upgrade_plugins_migrations RAILS_ENV=production
    1. if this goes on an infinite loop, go to Redmine DB plugin_schema_info table, and remove the entry mentioned in the loop. Execute the command again.
  13. clear cache
    rake tmp:chache:clear
    rake tmp:sessions:clear
  14. install Plugins
    rake db:migrate_plugins RAILS_ENV=production
    1. since I'm using libsvn plugin to access SVN repository, I had to install a new package...
      sudo aptitude install libsvn-ruby1.8
    2. if the Plugins installation aborts, or if not, but latter on Redmine keeps crashing, identify the Plugin in conflict and remove it from the plugins dir, and then re-execute the installation command (Apache has to be restarted every time this is done, so it has effect online)
  15. get Redmine back online, and notify users of the changes (DUH!)
    sudo /etc/init.d/apache2 start

RE: Troublesome upgrade from 0.8.4 to 1.0.0 - Added by Charlie Viaene about 13 years ago

paulo ferreira and Felix,
Thanks for sharing your update quest on this forum! Without your posts I would probably never have managed to successfully make the upgrade.
Therefore I add my success story to the list.

Original situation:

- Redmine Turnkey Linux Appliance (2009.10-2)  http://www.turnkeylinux.org/redmine
- 0.8.4 is by default installed needs an upgrade to 1.1.0
- No plugins were installed (turnkey appliance as is)

Where is "Redmine" ?:


  /var/www/railsapp                <- for some reason they called it railsapp and not redmine :-0
        /config/database.yml       <- some crucial files to backup
        /config/email.yml    
  railsapp_production              <- mysql database containing 'everything' 

Based on this thread I took following steps:

  • Backup your database

    - Using the Webmin interface I backup the railsapp_production
    -> https://192.168.2.100:12321/
    -> servers -> Mysql -> railsapp_production -> backup database -> select file
    -> Successfully backed up 202953 bytes from database railsapp_production to file /tmp/redmine.20110123.db

  • Stop apache
        sudo /etc/init.d/apache2 stop
    
  • Update my Ruby system
    
        root@redmine:/# gem sources -a http://rubygems.org/
        http://rubygems.org/ added to sources
    
        root@redmine:/# gem install rails -v=2.3.5
                        gem install rack -v=1.0.1
                        gem install -v=0.4.2 i18n
                        gem install rack mysql
    
  • Backup my 'old' Redmine
     root@redmine:/var/www# mv railsapp/ railsapp_old/
  • Download new Redmine and copy in that new Redmine the old settings
     root@redmine:/var/www#  wget http://rubyforge.org/frs/download.php/73902/redmine-1.1.0.zip

                             unzip redmine-1.1.0.zip

                             mv redmine-1.1.0 railsapp

                             cp -rf railsapp_old/files railsapp
                             cp railsapp_old/config/database.yml railsapp/config/
                             cp railsapp_old/config/email.yml railsapp/config/
  • Re-initialize Redmine
      root@redmine:/var/www/railsapp# rake config/initializers/session_store.rb

                                      rake generate_session_store

                                      rake db:migrate RAILS_ENV=production

                                      rake tmp:chache:clear
                                      rake tmp:sessions:clear

                                      rake db:migrate_plugins RAILS_ENV=production
  • Kick it!
      reboot
    (1-5/5)