Error while upgrading from 3.2.6 to 5.1.2
Added by Dirk Schaap 10 days ago
Hi all,
When upgrading from version 3.2.6 to 5.1.2 I get the following error when executing the command 'bundle exec rake db:migrate RAILS_ENV=production'.
== 20211213122102 RemoveOpenIdSetting: migrating ============================== == 20211213122102 RemoveOpenIdSetting: migrated (0.0033s) ===================== == 20220224194639 DeleteOrphanedTimeEntryActivities: migrating ================ == 20220224194639 DeleteOrphanedTimeEntryActivities: migrated (0.0138s) ======= == 20220714093000 AddJournalUpdatedOn: migrating ============================== -- add_column(:journals, :updated_on, :datetime, {:after=>:created_on}) rake aborted! StandardError: An error has occurred, all later migrations canceled: (StandardError) Mysql2::Error: Duplicate column name 'updated_on' /var/www/redmine/db/migrate/20220714093000_add_journal_updated_on.rb:3:in `up' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `load' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `<main>' Caused by: ActiveRecord::StatementInvalid: Mysql2::Error: Duplicate column name 'updated_on' (ActiveRecord::StatementInvalid) /var/www/redmine/db/migrate/20220714093000_add_journal_updated_on.rb:3:in `up' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `load' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `<main>' Caused by: Mysql2::Error: Duplicate column name 'updated_on' (Mysql2::Error) /var/www/redmine/db/migrate/20220714093000_add_journal_updated_on.rb:3:in `up' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `load' /usr/local/rbenv/versions/3.2.4/bin/bundle:25:in `<main>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
Extra information:
The Turnkey 18.1 version (with redmine 5.1.2 )from https://www.turnkeylinux.org/download?file=turnkey-redmine-18.1-bookworm-amd64.iso is used and installed on a different server.
These are the steps that are execuded to convert the data from version 3.2.6:
#import database in new installation mysql -u root redmine_production -p < /tmp/105_145_db_backup.sql # Update the database from /var/www/redmine #This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database: bundle exec rake db:migrate RAILS_ENV=production #If you have installed any plugins, you should also run their database migrations: bundle exec rake redmine:plugins:migrate RAILS_ENV=production
Note that in the old version there were a number of plugins that are not supported anymore. These plugins are:
usability ajax_counters a_common_libs unread_issues redmine_issue_tabs due_date_reminder clipboard_image_paste
Since the migration is aborted due to the error, the new version is not working as expected. Multiple web-pages show an 'Internal error' and it all seems incomplete.
Any help is very much appreciated.
Kind regards,
Dirk
Replies (1)
RE: Error while upgrading from 3.2.6 to 5.1.2 - Added by Dirk Schaap 9 days ago
Found it.
The journals table already has a column 'update_on' causing the migration to fail. To fix this, login to mysql (mysql -u root -p) and remove the column with the command:
alter table journals drop column updated_on;
Did a rerun of the command 'bundle exec rake db:migrate RAILS_ENV=production' and it all worked.