Advanced topics

For straight-forward migrations, the previous documentation pages should be enough to get you going. In more complex cases, the advanced techniques that follow may be helpful.

Ambiguous key fields in queries

If a column name in the source key passed to the map key appears in more than one table of the source query, you will get an error along the

Benchmarking performance of the migration

Migrate allows you to benchmark the migration and get execution time.

Cardinality violation with UNION queries

When your source query is a union, like

Chickens and eggs: using stubs

Suppose you are migrating articles from an external site into Drupal article nodes. These articles may reference each other, so in Drupal

Clean up migrate config during uninstall of migration

You might be getting several messages like this when you try to uninstall and reinstall a migration module:

Cross-database migrations

If your source data is in a database supported by the Drupal database API, such as MySQL or Postgres, and your web server has access to that

Highwater marks

By default, each time a migration is run, any previously unimported source items are imported (along with any previously-imported items

Multiple destination objects or entities

The Migration class is built on the fundamental assumption that there is a one-to-one correspondence between source rows coming in and

Multiple source data rows

The Migration class is built on the fundamental assumption that there is a one-to-one correspondence between source rows coming in and

Non-migration "migrations" - using MigrationBase

Describe how arbitrary processes can be performed in the course of migration using the MigrationBase class...

Preserving user passwords

One challenge frequently dealt with in migrations is handling user passwords. Usually the passwords on the old system are encrypted, and

Preventing deletion of files on rollback

If you are populating file fields on migration, and don't want the files to be deleted on rollback (e.g., you copied the files manually into

Running imports and rollbacks from the UI via drush

As explained at Why you should run migrations in Drush rather than the UI, drush is a faster and more robust means of running large

Running out of memory migrating images

Although Migrate detects when PHP is running low of memory and spawns a fresh process in that instance to avoid out-of-memory errors, I have

Source databases with fields/columns named using spaces or reserved words

Drupal's database abstraction layer cannot directly access columns named using spaces or reserved words: [#1426084].

Tuning your Drupal database for data migration

Data migration has different performance characteristics from normal website operations. The construction and delivery of a single web page

Updating existing content rather than importing new content - system-of-record

While the Migrate module was originally developed for the purpose of performing complete site migrations, where the source data is always

Guide maintainers

mikeryan's picture