Upgrade from 3.2.0 to 4.1.0 - encoding ??

Added by Anne Hammond 2 months ago

My previous mysql database was

encoding: utf8.

The instructions for 4.1.0 say to use

# Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
encoding: utf8mb4

I am using
mysql Ver 8.0.17 for Linux on x86_64 (Source distribution)

I loaded the database:
mysql -u redmine redmine -p < /tmp/redmine-mysql-backup.0.sql

Will using a different encoding from my loaded database be a problem?

Thanks in advance,

Replies (5)

RE: Upgrade from 3.2.0 to 4.1.0 - encoding ?? - Added by Anne Hammond 2 months ago

Yes, you have to convert your utf8 database to utfmb4.

I found this:

https://www.redmine.org/issues/10772

Then I did

mysql> use redmine;
mysql> ALTER DATABASE redmine CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
mysql> show tables;

From the output, I created a convert.sql script:
USE redmine;
ALTER TABLE agile_data                          CONVERT TO CHARACTER SET utf8mb4
 COLLATE utf8mb4_unicode_ci;
(one line for each table)

Then
mysql -u redmine -p  < convert.sql

mysql> show variables where Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name            | Value              |
+--------------------------+--------------------+
| character_set_client     | utf8mb4            |
| character_set_connection | utf8mb4            |
| character_set_database   | utf8mb4            |
| character_set_filesystem | binary             |
| character_set_results    | utf8mb4            |
| character_set_server     | utf8mb4            |
| character_set_system     | utf8               |
| collation_connection     | utf8mb4_0900_ai_ci |
| collation_database       | utf8mb4_unicode_ci |
| collation_server         | utf8mb4_0900_ai_ci |
+--------------------------+--------------------+
10 rows in set (0.01 sec)

I am researching some of the values above.

This page

https://mathiasbynens.be/notes/mysql-utf8mb4

indicates to

$ mysqlcheck -u root -p --auto-repair --optimize --all-databases

Stay tuned.

RE: Upgrade from 3.2.0 to 4.1.0 - encoding ?? - Added by Anne Hammond 2 months ago

After upgrading my database to utf8mb4, I get "Internal error" regarding Tracker

Completed 500 Internal Server Error in 161ms (ActiveRecord: 103.9ms)

ActionView::Template::Error (undefined method `description' for #<Tracker:0x000055dfa2661d68>):% @trackers.each do |tracker| >
66: <tr>
67: <td class="name">
68: <
= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id), :title => tracker.description >
70: <td>
71: <
= link_to @open_issues_by_tracker[tracker].to_i, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
app/views/projects/show.html.erb:68:in `block in app_views_projects_show_html_erb_1864405475639700376_70049391965740'`_app_views_projects_show_html_erb__1864405475639700376_70049391965740' `sudo_mode'

Is this core redmine ??

RE: Upgrade from 3.2.0 to 4.1.0 - encoding ?? - Added by Liane Hampe about 1 month ago

Hi Anne

Yes, the tracker description is an attribute of the Tracker model in Redmine core. If it is not defined, it may have different reasons.
Sometimes it is a loading problem. Therefore, restart the application server.

If the error remains, it is possible that the table column does not exists. The description column is new and needs to be migrated. Try to migrate again. If not successful try to redo the last migration and migrate again.

When you have a couple of problems it is possible that the migration with the respective missing column is marked as done and won't get repeated before it is reverted.

Long way for you. Hang in there, you will make it!

Best,
Liane

RE: Upgrade from 3.2.0 to 4.1.0 - encoding ?? - Added by Anne Hammond about 1 month ago

Thanks Liane,

I believe that I removed all the plugins from the redmine/plugins directory and then

cd /var/www/redmine
RAILS_ENV=production bundle exec rake db:migrate
systemctl restart httpd

That eliminated the Tracker error message.

Thank you so much,
Anne

RE: Upgrade from 3.2.0 to 4.1.0 - encoding ?? - Added by Anne Hammond about 1 month ago

I now can see all my issues and contacts. I did not ALTER all the tables in my utf8 database to be utf8mb4. That still remains a question.

This was the process:

After recreating the redmine database:

mysql> create database redmine character set utf8mb4;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
mysql> flush privileges;

RAILS_ENV=production bundle exec rake db:migrate

reloaded each plugin one by one to make sure they all migrate without error. In my case I had one plugin that didn't migrate, and I had to ask for a revised plugin.

Then I recreated the redmine database again:

mysql> use redmine;
mysql> drop database redmine:

mysql> create database redmine character set utf8mb4;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
mysql> flush privileges;
mysql> quit

RAILS_ENV=production bundle exec rake db:migrate

reload utf8 database from redmine 3.1.0:

mysql -u redmine redmine -p < /tmp/redmine-mysql-backup.0.sql

migrate all plugins one by one (did this for each redmineup plugin):

RAILS_ENV=production bundle exec rake redmine:plugins NAME=redmine_checklists

migrate database to redmine 4.1.0:

RAILS_ENV=production bundle exec rake db:migrate

I can now access issues and contacts.

As I said, I did not ALTER the tables to utf8mb4, but accept any advice.

Thanks in advance,
Anne

(1-5/5)