Migration of Users and Roles in Drupal 8

Step 1

Mention your Drupal 6 DB details in settings.php Screenshot reference below

Step 2

Create your custom module . You can clone sample migration module from https://github.com/lomasgupta/custom_migration/tree/staging

Files:

Custom_migration.info.yml Screenshot below

 

Create custom_migration.install Screenshot below

 

Create config/install folder under your custom migration module custom_migration

Copy :

Migrate_plus.migration.rb_d6_user.yml

Migrate_plus.migration.rb_d6_user_role.yml

Migrate_plus.migration_group.testgroup.yml

From the example module attached here.

We will now look at Migrate_plus.migration_group.testgroup.yml in detail:

Id:testgroup is the unique id for the migration group:

Source:

Key: legacy

Where legacy is the name given to the Drupal 6 DB in settings.php

We will now look at Migrate_plus.migration.rb_d6_user_role.yml in detail

id: rb_d6_user_role

label: User roles

migration_group: testgroup

migration_tags:

 - Drupal 6

source:

 plugin: d6_user_role

id: rb_d6_user_role

Where Id is the unique id for the migration script.

migration_group: testgroup : This will attach with the migration testgroup

Source:

  plugin: d6_user_role

This is a call to the core plugin. Reference Screenshot below:

We will now look at Migrate_plus.migration.rb_d6_user.yml in detail

Once all setup done with custom_migration module, enable the module and do a

drush ms

You will see the following output:


You can now see testgroup

Under testgroup you can see the migration scripts rb_d6_user_role / rb_d6_user_role

Now run a drush migrate-import (mi)  that will perform one or more migration processes :

drush mi rb_d6_user_role

Output :

Processed 3 items (3 created, 0 updated, 0 failed, 0 ignored) - done with 'rb_d6_user_role'

drush mi rb_d6_user.

Output :

Processed 24 items (21 created, 0 updated, 3 failed, 0 ignored) - done with 'rb_d6_user'

So now, we have completed users and roles migration from Drupal 6 to Drupal 8

Next blog will be migration of vocab and taxonomies....

Back