Advanced topics
For straight-forward migrations, the previous documentation pages should be enough to get you going. In more complex cases, the advanced
- Ambiguous key fields in queries
- Benchmarking performance of the migration
- Cardinality violation with UNION queries
- Chickens and eggs: using stubs
- Clean up migrate config during uninstall of migration
- Cross-database migrations
- Highwater marks
- Multiple destination objects or entities
- Multiple source data rows
- Non-migration "migrations" - using MigrationBase
- Preserving user passwords
- Preventing deletion of files on rollback
- Running imports and rollbacks from the UI via drush
- Running out of memory migrating images
- Source databases with fields/columns named using spaces or reserved words
- Tuning your Drupal database for data migration
- Updating existing content rather than importing new content - system-of-record
Caveats
Migrate is a powerful module - it can make massive changes to the destination site very quickly - so it pays to think carefully about
Contributed module support
Many contributed Drupal modules are responsible for maintaining data - they define new field types or entity types, or maintain custom
Cookbook
Here is a cookbook of useful tips and ideas for specialized applications - feel free to add your own Migrate V2 tricks!
- Adding serialized data to users data column
- Customized Mapping Migration of Drupal 6 content to new Drupal 8 instance.
- Disable hooks during migration
- Disable rules during a migration
- Expand the range of data tracked by the timer instrument during a migration
- How to create nodes with hierarchical terms from excel
- Import content and its translations from CSV
- Import new users and their Profile2 fields from one CSV file
- Importing Scheduled Content
- Migrate CSV files using intermediary SQL tables
- Migrating Book module nodes
- Migrating Photopost to Drupal 7
- Migrating vBulletin to Drupal 7
- Modifying node body during migration
- Outputting rejected source data
- Protecting fields on Migrate Updates
- Remapping taxonomy terms on import
- Simple D6 -> D7 profile migration
Destination classes
Each Migration implementation needs to create a destination object - a subclass of MigrateDestination (or its subclass
Developing wizards for registering migrations
Migrate 2.6 introduces an API to assist in the development of step-by-step wizards for registering migration processes. By implementing a
Drush commands for Drupal 7's Migrate module
Using drush, individual migrations can be imported and then rolled back. Running processes can be cleanly interrupted, individual source
External references
People have applied the Migrate module in many different contexts, using it in different ways. Fortunately, some have taken the time to
Field mappings
Source fields are mapped to destination fields by making calls to $this->addFieldMapping() in your Migration class constructor. Field
Getting started with Migrate
Note: This documentation is for Drupal 7 contrib Migrate module, the Drupal 8 core Migrate API documentation can be found here.
Handler classes
Handlers are classes which enable you to add additional behavior to the processing of data being imported. These are usually used to support
Improving migration performance
Migrating large volumes of data can take considerable time - hours, or if you're migrating millions of objects, days. Shaving a few
Map classes
A key feature of the Migrate module is the tracking of relationships between source records and the Drupal objects that have been created
Migrate module FAQ
Migrate module architecture
The central class in the Migrate module - the one you'll spend most of your time dealing with - is the Migration class. You derive your own
Migration and group registration
Migrations and migration groups
Migration classes
The Migrate module provides an abstract class named Migration - in most cases, you'll do nearly all your work in extending this class. The
Source classes
The Migrate module uses classes derived from the abstract class MigrateSource to encapsulate source data to be imported. In a Migration
Why you should run migrations in Drush rather than the UI
If at all possible, you should execute your migrations using Drush rather than the UI for all but the smallest projects. To understand why,
