Migration from 2.3.1 stable to 4.0.6.stable

Added by Brandon Winstead 4 months ago

I have inherited an old Redmine server that is in great need of updating. I am trying to migrate the old data to a newer server. I'm new to Redmine and not sure if I'm going about this the correct way.

The old server is:

Ubuntu 12.04

Environment:
Redmine version 2.3.1.stable
Ruby version 1.9.3 (x86_64-linux)
Rails version 3.2.13
Environment production
Database adapter Mysql2
Redmine plugins:
mixed_done_ratio 0.0.1
redmine_favorite_projects 1.0.1
redmine_pwauth 1.0

The new server is:

Ubuntu 20.04

Environment:
Redmine version 4.0.6.stable
Ruby version 2.7.0-p0 (2019-12-25) [x86_64-linux-gnu]
Rails version 5.2.3
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery sendmail
SCM:
Subversion 1.13.0
Mercurial 5.3.1
Cvs 1.12.13
Git 2.25.1
Filesystem
Redmine plugins:
no plugin installed

What I have done

1. Installed Redmine on new Ubuntu 20.04 install.

2. Dumped the MYSQL database from the old server to the new server.

3. Dropped the MYSQL database on the new server.

4. Added a new empty Redmine database to the new server.

5. Imported the dump file into the new Redmine server.

First issue

The first issue was a login error. Once I looked at the logs the server complained it couldn't update "updated_on" column. So I added it with:

ALTER TABLE tokens ADD updated_on VARCHAR;

Now the server seems happy with that.

Current issue

I still can't login but the error has changed.

Successful authentication for 'serveradmin' from 10.11.130.5 at 2021-08-06 13:58:58 UTC
Completed 500 Internal Server Error in 143ms (ActiveRecord: 57.3ms)

NoMethodError (undefined method `must_change_passwd?' for #<User:0x000055733cd8e7d0>
Did you mean? must_change_password?):

Here is where I'm stuck.

Will someone please help troubleshoot this or tell me I'm trying the migration in an incorrect way?

Replies (1)

RE: Migration from 2.3.1 stable to 4.0.6.stable - Added by Fletcher Johnston 4 months ago

When I migrated from Redmine 4.0.5 to 4.2.1 a while back I followed a similar process to yours. The main difference for me was:

  1. Install Redmine on new server (don't run migrations)
  2. Dump MySQL db from old server
  3. Import MySQL dump onto new server
  4. Run RAILS_ENV=production bundle exec rake db:migrate on the new server

However, I was going from 4.0 to 4.2.

Currently I'm running redmine 4.2.2. Looking at the database, the datatype for the updated_on column in the tokens table is TIMESTAMP. Here's the full create statement for the tokens table:

CREATE TABLE `tokens` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `user_id` INT(11) NOT NULL DEFAULT '0',
    `action` VARCHAR(30) NOT NULL DEFAULT '',
    `value` VARCHAR(40) NOT NULL DEFAULT '',
    `created_on` DATETIME NOT NULL,
    `updated_on` TIMESTAMP NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `tokens_value` (`value`),
    INDEX `index_tokens_on_user_id` (`user_id`)
)
;

I'm just guessing here, but maybe part of the issue stems from the migrations not being run and maybe some incorrect columns persisting from the 2.3.1 installation?

Happy to help try and debug further. Can you provide any additional details about the error message? Which webserver are you running?

(1-1/1)