Moving data to Drupal 8

Moving Up

Running Migrations

Now all the migrations are configured and ready to go. At this point, the only way to run a custom migration is with the drush command from Migrate Tools, which provides commands to run an individual migration or an entire migration group. You will need command-line access with drush to run the migrations.

The migrate-status (alias ms) command lists all available migrations, and the migrate-import (alias mi) command imports a single migration or an entire group. You can use the --group option to show only migrations in a specific group (Listing 10).

Listing 10

Status and Import Commands

$ drush ms --group=pets
Group: pets   Status  Total  Imported  Unprocessed  Last imported
pet_owners    Idle    50     0         N/A
pets          Idle    1455   0         N/A
$ drush mi pets
Processed 1455 items (1455 created, 0 updated,
  0 failed, 0 ignored) - done with 'pets'

You might want to test the migration by only importing a few nodes at first. The --limit flag can be used to import a specific number of items. For example, drush mi --limit=2 will import the first two items. Each time migrate_import runs, it will start where it left off from the previous import until all rows are imported.

The migrate-rollback (alias: mr) command can be used to remove all imported items. The --group option is also available to roll back all migration in a group:

$ drush mr pets
Rolled back 1455 items - done with 'pets'

A few other less common commands are:

  • migrate-stop – Cancel a running migration.
  • migrate-reset-status – Reset a migration to Idle if it was cancelled and left hanging in the "importing" state.
  • migrate-messages – View a list of messages associated with the migration.

Use drush help <command> to see all the available options.

How to Help

The Migrate API needs your help! Remember, it is still considered an experimental module, and contributors are needed to submit and patch issues. Mentoring is available during core office hours [6] to help you get started testing and writing patches. You can also follow @drupalmentoring on Twitter.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus