6.x or to 7.9 migration error (Mysql2::Error: Incorrect string value)

Created by: jmaslibre

I was migrating from GitLab v 6.1.0 to v 7.9.1 (7-9-stable branch) (using mysql), following:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.x-or-7.x-to-7.9.md

Short story: The new merge_request_diffs table is created with charset latin1 in Mysql.

Details: In the step:

# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production

I get the error message:

Mysql2::Error: Incorrect string value: '\xCE\xBC","m...' for column 'st_diffs' at row 39

Looking for a solution, I found: https://github.com/gitlabhq/gitlabhq/issues/6407

I had the same problem: the new merge_request_diffs table was created with charset latin1

I executed the command proposed by @ajbw :

alter table merge_request_diffs default character set = utf8 collate = utf8_unicode_ci;
alter table merge_request_diffs convert to character set utf8 collate utf8_unicode_ci;

and then I was able to finish the upgrade.

Thanks for your hard work on GitLab.