Drupal 8 migration is always painful if not planned well. You run into 'Trial-and-error' and end up spending a more time than it is worth.
Here, there are drush commands which you can use during the migration process. Some of them are from contributed modules which help you during the migration. Drush commands from such modules will be indicated so.
Drupal 8 migration
As we know, migration follows Extract-Transform-Load (ETL) method to migrate the data to Drupal 8.
Here are the steps:
- Extract is Source
- Transform is processing and mapping the data
- Load is setting/copying/saving the data to destination
Connects to the DB where you are migrating from. This command is useful when you are migrating from a Drupal 6 or Drupal 7 website. It takes following full form:
drush migrate-upgrade --legacy-db-url=mysql://user:email@example.com/d6db --legacy-root=http://myd6site.com
You can also chose to migrate configurations only using
drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db --legacy-root=http://example.com --configure-only
If you your source DB has a prefix in table names, use
After creating the migration, this command will give you an overview of the migration that can take place.
migrate-import or mim or mi
With this command, you actually initiate the migration. You can then selectively import individual or multiple migrations using their names of import them all with
drush migrate-import --all
drush mim <migration name>
With Migrate Manifest module, you can create a group of migration and execute them at once:
This command gives you a list of available migration
Migration can be defined in a YAML file as below:
# nodes - d6_node - d6_node_revision - d6_node_type - d6_view_modes - d6_filter_format - d6_field_instance_per_form_display - d6_field_instance_widget_settings - d6_field_formatter_settings - d6_field_instance - d6_field - d6_field_settings - d6_node_settings - d6_cck_field_values:* - d6_cck_field_revision:* # taxonomy fields - d6_term_node_revision - d6_term_node - d6_vocabulary_entity_display - d6_vocabulary_entity_form_display - d6_vocabulary_field_instance - d6_vocabulary_field # blocks - d6_block - d6_menu # custom blocks - d6_custom_block - d6_filter_format # book - d6_book - d6_book_settings # file migrations are configurable - d6_file: source: conf_path: sites/assets destination: source_base_path: destination/base/path destination_path_property: uri
Save this file and place it a directory which can be accessed during the migration.
drush migrate-manifest --legacy-db-url=mysql://user:pass@localhost/drupal_6 manifest.yml
For better control, you can place this YAML file in version control to track the changes.
drush migrate-rollback <migration_id>
When you have issues with migration or just testing your migration, you can always rollback them!
drush mr --group=files
You can stop an active migration using this command
drush migrate-stop <migration_id>
This command allows you to view messages associated with a migration to debug the process so you can identify the issue and correct it.
drush migrate-messages <migration_id>
Reset status of an active migration to idle and start over.
drush migrate-reset-status <migration_id>