I have a Drupal 7 site with a bunch of users. I want to migrate the users to Drupal 8 but not any of the content so I'm writing a crosswalk. Drupal 8 has uuid in the users table. Is there a way I can compute this or can I just set it to NULL? Thanks!


1 Answer 1


No, cannot be empty.

You can generate one with

$uuid_service = \Drupal::service('uuid');
$uuid = $uuid_service->generate();

If you use User::create it will automatically generate one for you.

  'uid' => $uid,
  'name' => '$user_name,
  'mail' => $email,
  'roles' => [],
  'pass' => [
    'value' => $hashed_drupal_7_password,
    'pre_hashed' => TRUE,
  'status' => 1,

Rather than code it from scratch. The proper, Drupal way, to migrate is using all of these:

I suggest your read this article A Quick Guide to Migrating Drupal Content from D7 to D8 which goes over how to migrate users and other scenarios.

  • Even easier, I discovered the Universally Unique IDentifier module for Drupal 7. That generated uuids that I can just port over.
    – Chanel
    Commented Oct 23, 2020 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.