Problem/Motivation

Migrating the users from D7 to D9 throws Integrity constraint violations:

[error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'UserName' for key 'user__name': INSERT INTO "users_field_data" ("uid", "langcode", "preferred_langcode", "preferred_admin_langcode", "name", "pass", "mail", "timezone", "status", "created", "changed", "access", "login", "init", "default_langcode", "drupal_id") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array
(
    [:db_insert_placeholder_0] => 367758
    [:db_insert_placeholder_1] => 
    [:db_insert_placeholder_2] => 
    [:db_insert_placeholder_3] => 
    [:db_insert_placeholder_4] => UserName
    [:db_insert_placeholder_5] => nope
    [:db_insert_placeholder_6] => d49b2d3bce8b711a1b50703140968e35@sanitized.invalid
    [:db_insert_placeholder_7] => Europe/Berlin
    [:db_insert_placeholder_8] => 1
    [:db_insert_placeholder_9] => 1348182251
    [:db_insert_placeholder_10] => 1348182251
    [:db_insert_placeholder_11] => 280299600
    [:db_insert_placeholder_12] => 1396454944
    [:db_insert_placeholder_13] => www.staging.devdrupal.org/user/2301392/edit
    [:db_insert_placeholder_14] => 1
    [:db_insert_placeholder_15] => 
)
 in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 50 of /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php).

Apparently D7 had a different collation on the username field than D9 has now.
Looking at the datasets in D7 the following usernames were allowed and handled as different users:
* username
* Username
* UserName
* USERNAME

Migrating those to D9 is not possible, unless we change the collation of the field users_field_data.name to allow these variations.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sanduhrs created an issue. See original summary.

sanduhrs’s picture

Processed 126448 items (126348 created, 0 updated, 100 failed, 0 ignored)

Apparently 100 cases exist.

sanduhrs’s picture

StatusFileSize
new422 bytes
fmb’s picture

We should fix the patch as it creates a "b" folder (because of its fifth line), and then merge it.

teebeecoder’s picture

StatusFileSize
new782 bytes
teebeecoder’s picture

teebeecoder’s picture

teebeecoder’s picture

@FMB, I updated the patch and I also opened a MR on GitLab if needed.

Hope this help.

teebeecoder’s picture

Status: Active » Reviewed & tested by the community

fmb’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

fmb’s picture

I also removed the patch on the Localize platform.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.