1

I'm migrating users from a Drupal 6 to a Drupal 8 site. I use the original d6_user source plugin provided by the User module, so nothing really specific about that part.

I'm experiencing many integrity constraint violation errors with messages similar to the following.

1062 Duplicate entry 'Saïd-fr' for key 'user__name' trying to insert datas in users_field_data table. user__name is a unique key composed of name and langcode field.

Investigating a bit more, I found the original Drupal 6 site user data had another name entry of value "Said" for the same language (since both sites are monolingual). Checking users table definition shows the collation is utf8mb4_general_ci. As explained here the ci suffix means case insensitive, which means for example I, i or even ï are considered the same by MySQL when comparing strings, which leads to the duplicate entry error. For the record, the Drupal 6 users table from which the name field comes from has the latin1_general_ci collation. Although it is 'ci' suffixed, it obviously authorizes this kind of duplicate.

This lack of compatibility between Drupal 6 and Drupal 8 database schema is for me a problem, since I'm unable to migrate approximately 800 user accounts. I've changed this specific field to utf8_bin collation and it seems to correct the issue.

Do you think it's a good solution? Is the utf8_bin the best collation for that purpose? Can it lead to problem in the future to change the Drupal 8 database schema?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.